diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9ef70508..434921a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -42,6 +42,7 @@ const Map> localizedValues = { "referral": {"en": "Referral", "ar": "الإحالة"}, "inPatient": {"en": "InPatients", "ar": "مرضاي"}, "myInPatient": {"en": "My\nInPatients", "ar": "مرضاي\nالمنومين"}, + "myInPatientTitle": {"en": "My InPatients", "ar": "مرضاي المنومين"}, "inPatientLabel": {"en": "InPatients", "ar": "المريض المنوم"}, "inPatientAll": {"en": "All InPatients", "ar": "جميع المرضى المنومين"}, "operations": {"en": "Operations", "ar": "عمليات"}, @@ -702,11 +703,11 @@ const Map> localizedValues = { "patientArrived": {"en": "Patient Arrived", "ar": "وصل المريض"}, "calledAndNoResponse": {"en": "Called And No Response", "ar": "تم الاتصال ولا يوجد رد"}, "underProcess": {"en": "Under Process", "ar": "تحت التجهيز"}, - "textResponse": {"en": "Text Response", "ar": "استجابة النص" - } - , + "textResponse": {"en": "Text Response", "ar": "استجابة النص"}, + "notReplied": {"en": "Not Replied", "ar": "لم يتم يرد"}, "requestType":{ "en":"Request Type", "ar":"نوع الطلب"}, - "special": {"en": "Special", "ar": "خاص"} + "special": {"en": "Special", "ar": "خاص"}, + "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} }; diff --git a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart index 7c6d0db5..8ba07f2a 100644 --- a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart +++ b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart @@ -30,6 +30,11 @@ class GetMedicationForInPatientModel { dynamic strength; String pHRItemDescription; String pHRItemDescriptionN; + String doctorName; + String uomDescription; + String routeDescription; + String directionDescription; + String refillDescription; GetMedicationForInPatientModel( {this.setupID, @@ -62,11 +67,22 @@ class GetMedicationForInPatientModel { this.editedOn, this.strength, this.pHRItemDescription, - this.pHRItemDescriptionN}); + this.pHRItemDescriptionN, + this.doctorName, + this.uomDescription, + this.routeDescription, + this.directionDescription, + this.refillDescription}); GetMedicationForInPatientModel.fromJson(Map json) { setupID = json['SetupID']; projectID = json['ProjectID']; + doctorName = json['DoctorName']; + refillDescription = json['RefillDescription']; + directionDescription = json['DirectionDescription']; + routeDescription = json['RouteDescription']; + + uomDescription = json['UOMDescription']; admissionNo = json['AdmissionNo']; patientID = json['PatientID']; orderNo = json['OrderNo']; @@ -101,6 +117,11 @@ class GetMedicationForInPatientModel { Map toJson() { final Map data = new Map(); data['SetupID'] = this.setupID; + data['DoctorName'] = this.doctorName; + data['RefillDescription'] = this.refillDescription; + data['RouteDescription'] = this.routeDescription; + data['DirectionDescription'] = this.directionDescription; + data['UOMDescription'] = this.uomDescription; data['ProjectID'] = this.projectID; data['AdmissionNo'] = this.admissionNo; data['PatientID'] = this.patientID; diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart index dfbd444c..5178ab14 100644 --- a/lib/core/model/procedure/get_ordered_procedure_request_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -1,18 +1,22 @@ class GetOrderedProcedureRequestModel { String vidaAuthTokenID; int patientMRN; + int appointmentNo; - GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); + GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN, this.appointmentNo}); GetOrderedProcedureRequestModel.fromJson(Map json) { vidaAuthTokenID = json['VidaAuthTokenID']; patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; } Map toJson() { final Map data = new Map(); data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + return data; } } diff --git a/lib/core/service/home/doctor_reply_service.dart b/lib/core/service/home/doctor_reply_service.dart index cdb45f1b..c3f4584d 100644 --- a/lib/core/service/home/doctor_reply_service.dart +++ b/lib/core/service/home/doctor_reply_service.dart @@ -8,39 +8,56 @@ import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patien import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; class DoctorReplyService extends BaseService { - - List get listDoctorWorkingHoursTable => _listDoctorWorkingHoursTable; + List get listDoctorWorkingHoursTable => + _listDoctorWorkingHoursTable; + List get listDoctorNotRepliedQuestions => + _listDoctorNotRepliedQuestions; List _listDoctorWorkingHoursTable = []; - - + List _listDoctorNotRepliedQuestions = []; List _listMyReferralPatientModel = []; - List get listMyReferralPatientModel => _listMyReferralPatientModel; + + List get listMyReferralPatientModel => + _listMyReferralPatientModel; int notRepliedCount = 0; - Future getDoctorReply(RequestDoctorReply _requestDoctorReply,{bool clearData = false}) async { + Future getDoctorReply(RequestDoctorReply _requestDoctorReply, + {bool clearData = false, bool isGettingNotReply = false}) async { hasError = false; - await baseAppClient.post(GT_MY_PATIENT_QUESTION, - onSuccess: (dynamic response, int statusCode) { - if(clearData) + await baseAppClient.post( + GT_MY_PATIENT_QUESTION, + onSuccess: (dynamic response, int statusCode) { + if (clearData) { + if(isGettingNotReply) + _listDoctorNotRepliedQuestions.clear(); + else _listDoctorWorkingHoursTable.clear(); - response['List_GtMyPatientsQuestions'].forEach((v) { - _listDoctorWorkingHoursTable - .add(ListGtMyPatientsQuestions.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestDoctorReply.toJson(),); + } + + + response['List_GtMyPatientsQuestions'].forEach((v) { + + if(isGettingNotReply) + _listDoctorNotRepliedQuestions.add(ListGtMyPatientsQuestions.fromJson(v)); + else + _listDoctorWorkingHoursTable + .add(ListGtMyPatientsQuestions.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestDoctorReply.toJson(), + ); } Future createDoctorResponse( - CreateDoctorResponseModel createDoctorResponseModel) async { - hasError = false; + CreateDoctorResponseModel createDoctorResponseModel) async { + hasError = false; await baseAppClient.post( CREATE_DOCTOR_RESPONSE, body: createDoctorResponseModel.toJson(), - onSuccess: (dynamic body, int statusCode) { - }, + onSuccess: (dynamic body, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -48,14 +65,12 @@ class DoctorReplyService extends BaseService { ); } - Future getNotRepliedCount() async { - hasError = false; + hasError = false; await baseAppClient.post( GET_DOCTOR_NOT_REPLIED_COUNTS, body: {}, - onSuccess: (dynamic body - , int statusCode) { + onSuccess: (dynamic body, int statusCode) { notRepliedCount = body["DoctorNotRepliedCounts"]; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart index 9937286b..06de5a74 100644 --- a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart @@ -194,7 +194,7 @@ class PrescriptionsService extends BaseService { isDentalAllowedBackend: false, admissionNo: int.parse(patient.admissionNo), tokenID: "@dm!n", - projectID: 15, + projectID: patient.projectId, ); await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 526b2b3e..56a92de5 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -28,16 +28,12 @@ class ProcedureService extends BaseService { List templateList = List(); List _templateDetailsList = List(); - List get templateDetailsList => - _templateDetailsList; + List get templateDetailsList => _templateDetailsList; - GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(); + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); - ProcedureTempleteRequestModel _procedureTempleteRequestModel = - ProcedureTempleteRequestModel(); - ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, @@ -63,8 +59,7 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); - Future getProcedureTemplate( - {int doctorId, int projectId, int clinicId, String categoryID}) async { + Future getProcedureTemplate({int doctorId, int projectId, int clinicId, String categoryID}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( // tokenID: "@dm!n", patientID: 0, @@ -72,19 +67,18 @@ class ProcedureService extends BaseService { ); hasError = false; - await baseAppClient.post(GET_TEMPLETE_LIST/*GET_PROCEDURE_TEMPLETE*/, + await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/, onSuccess: (dynamic response, int statusCode) { - templateList.clear(); + templateList.clear(); response['DAPP_TemplateGetList'].forEach((template) { ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); - if(categoryID != null){ - if(categoryID == templateElement.categoryID){ + if (categoryID != null) { + if (categoryID == templateElement.categoryID) { templateList.add(templateElement); } } else { templateList.add(templateElement); } - }); // response['HIS_ProcedureTemplateList'].forEach((template) { // _templateList.add(ProcedureTempleteModel.fromJson(template)); @@ -95,21 +89,17 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteRequestModel.toJson()); } - Future getProcedureTemplateDetails( - {int doctorId, int projectId, int clinicId, int templateId}) async { + Future getProcedureTemplateDetails({int doctorId, int projectId, int clinicId, int templateId}) async { _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel( - templateID: templateId, searchType: 1, patientID: 0); + ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0); hasError = false; //insuranceApprovalInPatient.clear(); _templateDetailsList.clear(); - await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) { //prescriptionsList.clear(); response['HIS_ProcedureTemplateDetailsList'].forEach((template) { - _templateDetailsList - .add(ProcedureTempleteDetailsModel.fromJson(template)); + _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -117,15 +107,14 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteDetailsRequestModel.toJson()); } - Future getProcedure({int mrn}) async { - _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(patientMRN: mrn); + Future getProcedure({int mrn, int appointmentNo}) async { + _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel( + patientMRN: mrn, + ); hasError = false; _procedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { - _procedureList.add( - GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -135,8 +124,7 @@ class ProcedureService extends BaseService { Future getCategory() async { hasError = false; - await baseAppClient.post(GET_LIST_CATEGORISE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_LIST_CATEGORISE, onSuccess: (dynamic response, int statusCode) { categoryList = []; categoryList = response['listProcedureCategories']['entityList']; }, onFailure: (String error, int statusCode) { @@ -145,7 +133,7 @@ class ProcedureService extends BaseService { }, body: Map()); } - Future getProcedureCategory({String categoryName, String categoryID,patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], patientMRN: patientId, @@ -156,10 +144,8 @@ class ProcedureService extends BaseService { ); hasError = false; _categoriesList.clear(); - await baseAppClient.post(GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { + _categoriesList.add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -169,8 +155,7 @@ class ProcedureService extends BaseService { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(POST_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -178,12 +163,10 @@ class ProcedureService extends BaseService { }, body: postProcedureReqModel.toJson()); } - Future updateProcedure( - UpdateProcedureRequestModel updateProcedureRequestModel) async { + Future updateProcedure(UpdateProcedureRequestModel updateProcedureRequestModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(UPDATE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { print("ACCEPTED"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -191,14 +174,11 @@ class ProcedureService extends BaseService { }, body: updateProcedureRequestModel.toJson()); } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async { hasError = false; _valadteProcedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_VALIDATION, - onSuccess: (dynamic response, int statusCode) { - _valadteProcedureList.add( - ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_VALIDATION, onSuccess: (dynamic response, int statusCode) { + _valadteProcedureList.add(ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 57a54ed0..ec127f8b 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -85,7 +85,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = super.error+ "\n"+error; }, body: postAllergyRequestModel.toJson()); } @@ -97,13 +97,14 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error =super.error + "\n"+error; }, body: postHistoriesRequestModel.toJson()); } Future postChiefComplaint( PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { hasError = false; + super.error =""; await baseAppClient.post(POST_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); @@ -157,7 +158,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = "\n"+error; }, body: patchAllergyRequestModel.toJson()); } @@ -169,13 +170,14 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = super.error +"\n"+error; }, body: patchHistoriesRequestModel.toJson()); } Future patchChiefComplaint( PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { hasError = false; + super.error =""; await baseAppClient.post(PATCH_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 29bbc6aa..84fe8b44 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -14,26 +14,39 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); - SpecialClinicsService _specialClinicsService = locator(); + SpecialClinicsService _specialClinicsService = + locator(); List get patientList => _outPatientService.patientList; - List get specialClinicalCareMappingList => - _specialClinicsService.specialClinicalCareMappingList; + + List + get specialClinicalCareMappingList => + _specialClinicsService.specialClinicalCareMappingList; List filterData = []; DateTime selectedFromDate; DateTime selectedToDate; + int firstSubsetIndex = 0; + int inPatientPageSize = 20; + int lastSubsetIndex = 20; + + List InpatientClinicList = []; + searchData(String str) { var strExist = str.length > 0 ? true : false; if (strExist) { filterData = []; for (var i = 0; i < _outPatientService.patientList.length; i++) { - String firstName = _outPatientService.patientList[i].firstName.toUpperCase(); - String lastName = _outPatientService.patientList[i].lastName.toUpperCase(); - String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase(); - String patientID = _outPatientService.patientList[i].patientId.toString(); + String firstName = + _outPatientService.patientList[i].firstName.toUpperCase(); + String lastName = + _outPatientService.patientList[i].lastName.toUpperCase(); + String mobile = + _outPatientService.patientList[i].mobileNumber.toUpperCase(); + String patientID = + _outPatientService.patientList[i].patientId.toString(); if (firstName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) || @@ -49,7 +62,8 @@ class PatientSearchViewModel extends BaseViewModel { } } - getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { + getOutPatient(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -74,16 +88,16 @@ class PatientSearchViewModel extends BaseViewModel { sortOutPatient({bool isDes = false}) { if (isDes) filterData = filterData.reversed.toList(); - // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>b.appointmentDateWithDateTimeForm.compareTo(a.appointmentDateWithDateTimeForm)); else filterData = filterData.reversed.toList(); - // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>a.appointmentDateWithDateTimeForm.compareTo(b.appointmentDateWithDateTimeForm)); setState(ViewState.Idle); } - getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { + getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { setState(ViewState.Busy); - await _outPatientService.getPatientFileInformation(patientSearchRequestModel); + await _outPatientService + .getPatientFileInformation(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; setState(ViewState.Error); @@ -102,21 +116,32 @@ class PatientSearchViewModel extends BaseViewModel { String dateTo; String dateFrom; if (OutPatientFilterType.Previous == outPatientFilterType) { - selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); - selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + selectedFromDate = DateTime( + DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); + selectedToDate = DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); - dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); + dateFrom = + AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); } else if (OutPatientFilterType.NextWeek == outPatientFilterType) { dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day + 6), + 'yyyy-MM-dd'); dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day + 1), + 'yyyy-MM-dd'); } else { dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); } PatientSearchRequestModel currentModel = PatientSearchRequestModel(); currentModel.patientID = patientSearchRequestModel.patientID; @@ -130,13 +155,16 @@ class PatientSearchViewModel extends BaseViewModel { filterData = _outPatientService.patientList; } - PatientInPatientService _inPatientService = locator(); + PatientInPatientService _inPatientService = + locator(); List get inPatientList => _inPatientService.inPatientList; - List get myIinPatientList => _inPatientService.myInPatientList; + List get myIinPatientList => + _inPatientService.myInPatientList; List filteredInPatientItems = List(); + List filteredMyInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false, bool isLocalBusy = false}) async { @@ -146,7 +174,8 @@ class PatientSearchViewModel extends BaseViewModel { } else { setState(ViewState.Busy); } - if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); + if (inPatientList.length == 0) + await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; if (isLocalBusy) { @@ -156,59 +185,215 @@ class PatientSearchViewModel extends BaseViewModel { } } else { setDefaultInPatientList(); + generateInpatientClinicList(); setState(ViewState.Idle); } } - sortInPatient({bool isDes = false}) { - if (isDes) - filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - b.admissionDateWithDateTimeForm.compareTo(a.admissionDateWithDateTimeForm)); - else - filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - a.admissionDateWithDateTimeForm.compareTo(b.admissionDateWithDateTimeForm)); + sortInPatient({bool isDes = false, bool isAllClinic, bool isMyInPatient}) { + if (isMyInPatient + ? myIinPatientList.length > 0 + : isAllClinic + ? inPatientList.length > 0 + : filteredInPatientItems.length > 0) { + List localInPatient = isMyInPatient + ? [...filteredMyInPatientItems] + : isAllClinic + ? [...inPatientList] + : [...filteredInPatientItems]; + if (isDes) + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b + .admissionDateWithDateTimeForm + .compareTo(a.admissionDateWithDateTimeForm)); + else + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a + .admissionDateWithDateTimeForm + .compareTo(b.admissionDateWithDateTimeForm)); + if (isMyInPatient) { + filteredMyInPatientItems.clear(); + filteredMyInPatientItems.addAll(localInPatient); + } else if (isAllClinic) { + resetInPatientPagination(); + filteredInPatientItems + .addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex)); + } else { + filteredInPatientItems.clear(); + filteredInPatientItems.addAll(localInPatient); + } + } setState(ViewState.Idle); } + resetInPatientPagination() { + filteredInPatientItems.clear(); + firstSubsetIndex = 0; + lastSubsetIndex = inPatientPageSize - 1; + } + Future setDefaultInPatientList() async { setState(ViewState.BusyLocal); await getDoctorProfile(); - filteredInPatientItems.clear(); - if (inPatientList.length > 0) filteredInPatientItems.addAll(inPatientList); + resetInPatientPagination(); + if (inPatientList.length > 0) + filteredInPatientItems + .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + + if (myIinPatientList.length > 0) { + filteredMyInPatientItems.addAll(myIinPatientList); + } setState(ViewState.Idle); } + generateInpatientClinicList() { + inPatientList.forEach((element) { + if (!InpatientClinicList.contains(element.clinicDescription)) { + InpatientClinicList.add(element.clinicDescription); + } + }); + } + + addOnFilteredList() { + if (lastSubsetIndex < inPatientList.length) { + firstSubsetIndex = firstSubsetIndex + + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 + ? inPatientList.length - lastSubsetIndex + : inPatientPageSize - 1); + lastSubsetIndex = lastSubsetIndex + + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 + ? inPatientList.length - lastSubsetIndex + : inPatientPageSize - 1); + filteredInPatientItems + .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + setState(ViewState.Idle); + } + } + + removeOnFilteredList() { + if (lastSubsetIndex - inPatientPageSize - 1 > 0) { + filteredInPatientItems.removeAt(lastSubsetIndex - inPatientPageSize - 1); + setState(ViewState.Idle); + } + } + + filterByHospital({int hospitalId}) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + if (inPatientList[i].projectId == hospitalId) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } + + filterByClinic({String clinicName}) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + if (inPatientList[i].clinicDescription == clinicName) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } + void clearPatientList() { _inPatientService.inPatientList = []; _inPatientService.myInPatientList = []; } - void filterSearchResults(String query) { + void filterSearchResults(String query, + {bool isAllClinic, bool isMyInPatient}) { var strExist = query.length > 0 ? true : false; - if (strExist) { - filteredInPatientItems = []; - for (var i = 0; i < inPatientList.length; i++) { - String firstName = inPatientList[i].firstName.toUpperCase(); - String lastName = inPatientList[i].lastName.toUpperCase(); - String mobile = inPatientList[i].mobileNumber.toUpperCase(); - String patientID = inPatientList[i].patientId.toString(); - - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { - filteredInPatientItems.add(inPatientList[i]); + + if (isMyInPatient) { + List localFilteredMyInPatientItems = [ + ...myIinPatientList + ]; + + if (strExist) { + filteredMyInPatientItems.clear(); + for (var i = 0; i < localFilteredMyInPatientItems.length; i++) { + String firstName = + localFilteredMyInPatientItems[i].firstName.toUpperCase(); + String lastName = + localFilteredMyInPatientItems[i].lastName.toUpperCase(); + String mobile = + localFilteredMyInPatientItems[i].mobileNumber.toUpperCase(); + String patientID = + localFilteredMyInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredMyInPatientItems.add(localFilteredMyInPatientItems[i]); + } } + notifyListeners(); + } else { + if (myIinPatientList.length > 0) filteredMyInPatientItems.clear(); + filteredMyInPatientItems.addAll(myIinPatientList); + notifyListeners(); } - notifyListeners(); } else { - if (inPatientList.length > 0) filteredInPatientItems.clear(); - filteredInPatientItems.addAll(inPatientList); - notifyListeners(); + if (isAllClinic) { + if (strExist) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + String firstName = inPatientList[i].firstName.toUpperCase(); + String lastName = inPatientList[i].lastName.toUpperCase(); + String mobile = inPatientList[i].mobileNumber.toUpperCase(); + String patientID = inPatientList[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } else { + if (inPatientList.length > 0) filteredInPatientItems.clear(); + filteredInPatientItems.addAll(inPatientList); + notifyListeners(); + } + } else { + List localFilteredInPatientItems = [ + ...filteredInPatientItems + ]; + + if (strExist) { + filteredInPatientItems.clear(); + for (var i = 0; i < localFilteredInPatientItems.length; i++) { + String firstName = + localFilteredInPatientItems[i].firstName.toUpperCase(); + String lastName = + localFilteredInPatientItems[i].lastName.toUpperCase(); + String mobile = + localFilteredInPatientItems[i].mobileNumber.toUpperCase(); + String patientID = + localFilteredInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(localFilteredInPatientItems[i]); + } + } + notifyListeners(); + } else { + if (localFilteredInPatientItems.length > 0) + filteredInPatientItems.clear(); + filteredInPatientItems.addAll(localFilteredInPatientItems); + notifyListeners(); + } + } } } - getSpecialClinicalCareMappingList(clinicId, {bool isLocalBusy = false}) async { + getSpecialClinicalCareMappingList(clinicId, + {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 78c309ca..83cd43e3 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -28,7 +28,9 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; @@ -199,38 +201,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postAllergy(postAllergyRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future postHistories( - PostHistoriesRequestModel postHistoriesRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postHistories(postHistoriesRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future postChiefComplaint( - PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - Future postPhysicalExam( PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); @@ -264,38 +234,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchAllergy(patchAllergyRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future patchHistories( - PostHistoriesRequestModel patchHistoriesRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchHistories(patchHistoriesRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future patchChiefComplaint( - PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - Future patchPhysicalExam( PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); @@ -361,28 +299,6 @@ class SOAPViewModel extends BaseViewModel { return allergiesString; } - Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, - {bool isFirst = false}) async { - setState(ViewState.Busy); - await _SOAPService.getPatientHistories(getHistoryReqModel, - isFirst: isFirst); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } - - Future getPatientChiefComplaint( - GetChiefComplaintReqModel getChiefComplaintReqModel) async { - setState(ViewState.Busy); - await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } Future getPatientPhysicalExam( PatiantInformtion patientInfo, @@ -742,20 +658,16 @@ class SOAPViewModel extends BaseViewModel { } } if (allMedicationList.length == 0) { - await getMedicationList(); if (services == null) { - services = [ - _prescriptionService.getMedicationList() - ]; + services = [_prescriptionService.getMedicationList()]; } else { - services.add( - _prescriptionService.getMedicationList()); + services.add(_prescriptionService.getMedicationList()); } } final results = await Future.wait(services ?? []); - if (_SOAPService.hasError ||_prescriptionService.hasError ) { + if (_SOAPService.hasError || _prescriptionService.hasError) { error = _SOAPService.error + _prescriptionService.error; setState(ViewState.ErrorLocal); } else @@ -763,8 +675,7 @@ class SOAPViewModel extends BaseViewModel { } callAddAssessmentLookupsServices({bool allowSetState = true}) async { - if(allowSetState) - setState(ViewState.Busy); + if (allowSetState) setState(ViewState.Busy); var services; if (listOfDiagnosisCondition.length == 0) { if (services == null) { @@ -782,59 +693,177 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType) ]; } else { - services.add(_SOAPService.getMasterLookup( - MasterKeysService.DiagnosisType)); + services + .add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)); } } if (listOfICD10.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.ICD10) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.ICD10)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.ICD10)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.ICD10)); } } final results = await Future.wait(services ?? []); - if(allowSetState) { + if (allowSetState) { if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - } onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async { - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: - int.parse(patientInfo.appointmentNo.toString())); + appointmentNo: int.parse(patientInfo.appointmentNo.toString())); - var services = [ - _SOAPService.getPatientAssessment(getAssessmentReqModel) - ]; + var services = [_SOAPService.getPatientAssessment(getAssessmentReqModel)]; final results = await Future.wait(services); - if (patientAssessmentList.isNotEmpty) { await callAddAssessmentLookupsServices(allowSetState: false); } if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + postSubjectServices( + {patientInfo, + String complaintsText, + String medicationText, + String illnessText, + List myHistoryList, + List myAllergiesList}) async { + var services; + + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + createPostChiefComplaintRequestModel( + patientInfo: patientInfo, + illnessText: illnessText, + medicationText: medicationText, + complaintsText: complaintsText); + if (patientChiefComplaintList.isEmpty) { + postChiefComplaintRequestModel.editedBy = ''; + services = [ + _SOAPService.postChiefComplaint(postChiefComplaintRequestModel) + ]; + } else { + postChiefComplaintRequestModel.editedBy = ''; + services = [ + _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel) + ]; + } + + if (myHistoryList.length != 0) { + PostHistoriesRequestModel postHistoriesRequestModel = + createPostHistoriesRequestModel( + patientInfo: patientInfo, myHistoryList: myHistoryList); + + if (patientHistoryList.isEmpty) { + services.add(_SOAPService.postHistories(postHistoriesRequestModel)); + } else { + services.add(_SOAPService.patchHistories(postHistoriesRequestModel)); + } + } + + if (myAllergiesList.length != 0) { + PostAllergyRequestModel postAllergyRequestModel =createPostAllergyRequestModel (myAllergiesList:myAllergiesList, patientInfo: patientInfo); + if (patientAllergiesList.isEmpty) { + services.add(_SOAPService.postAllergy(postAllergyRequestModel)); + } else { + services.add(_SOAPService.patchAllergy(postAllergyRequestModel)); + } + + } + + final results = await Future.wait(services); + + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); } else - setState(ViewState.Idle); + setState(ViewState.Idle); + } + + PostChiefComplaintRequestModel createPostChiefComplaintRequestModel( + {patientInfo, + String complaintsText, + String medicationText, + String illnessText}) { + return new PostChiefComplaintRequestModel( + admissionNo: patientInfo.admissionNo != null + ? int.parse(patientInfo.admissionNo) + : null, + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo ?? 0, + appointmentNo: patientInfo.appointmentNo ?? 0, + chiefComplaint: complaintsText, + currentMedication: medicationText, + hopi: illnessText, + isLactation: false, + ispregnant: false, + doctorID: '', + numberOfWeeks: 0); + } + + PostHistoriesRequestModel createPostHistoriesRequestModel( + {patientInfo, List myHistoryList}) { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(doctorID: ''); + myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: patientInfo.appointmentNo, + remarks: "", + historyId: history.selectedHistory.id, + historyType: history.selectedHistory.typeId, + isChecked: history.isChecked, + )); + }); + + return postHistoriesRequestModel; + } + + + PostAllergyRequestModel createPostAllergyRequestModel({myAllergiesList, patientInfo}){ + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); + myAllergiesList.forEach((allergy) { + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); + }); + return postAllergyRequestModel; } } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index d1d4a3e8..cad5fa87 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -253,7 +253,7 @@ class AuthenticationViewModel extends BaseViewModel { /// add  token to shared preferences in case of send activation code is success setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async { - // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, diff --git a/lib/core/viewModel/doctor_replay_view_model.dart b/lib/core/viewModel/doctor_replay_view_model.dart index 17607d80..707fb805 100644 --- a/lib/core/viewModel/doctor_replay_view_model.dart +++ b/lib/core/viewModel/doctor_replay_view_model.dart @@ -12,9 +12,14 @@ class DoctorReplayViewModel extends BaseViewModel { List get listDoctorWorkingHoursTable => _doctorReplyService.listDoctorWorkingHoursTable; + List get listDoctorNotRepliedQuestions => + _doctorReplyService.listDoctorNotRepliedQuestions; Future getDoctorReply( - {int pageSize = 10, int pageIndex = 1, bool isLocalBusy = true}) async { + {int pageSize = 10, + int pageIndex = 1, + bool isLocalBusy = true, + bool isGettingNotReply = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -23,8 +28,11 @@ class DoctorReplayViewModel extends BaseViewModel { await getDoctorProfile(); RequestDoctorReply _requestDoctorReply = RequestDoctorReply(pageIndex: pageIndex, pageSize: pageSize); + if (isGettingNotReply) + _requestDoctorReply.infoStatus = 99; //to get the not replied only - await _doctorReplyService.getDoctorReply(_requestDoctorReply, clearData:!isLocalBusy ); + await _doctorReplyService.getDoctorReply(_requestDoctorReply, + clearData: !isLocalBusy, isGettingNotReply: isGettingNotReply); if (_doctorReplyService.hasError) { error = _doctorReplyService.error; if (isLocalBusy) { diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index b6887061..1dc34679 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel { List get orderProcedures => _ucafService.orderProcedureList; + Function saveUCAFOnTap; + String selectedLanguage; String heightCm = "0"; String weightKg = "0"; @@ -45,7 +47,11 @@ class UcafViewModel extends BaseViewModel { String respirationBeatPerMinute = "0"; String bloodPressure = "0 / 0"; - resetDataInFirst() { + resetDataInFirst({bool firstPage = true}) { + if(firstPage){ + _ucafService.patientVitalSignsHistory = []; + _ucafService.patientChiefComplaintList = []; + } _ucafService.patientAssessmentList = []; _ucafService.orderProcedureList = []; _ucafService.prescriptionList = null; @@ -56,7 +62,7 @@ class UcafViewModel extends BaseViewModel { } Future getUCAFData(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); String from; String to; @@ -112,7 +118,7 @@ class UcafViewModel extends BaseViewModel { Future getPatientAssessment(PatiantInformtion patient) async { if (patientAssessmentList.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPatientAssessment(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -139,7 +145,7 @@ class UcafViewModel extends BaseViewModel { Future getOrderProcedures(PatiantInformtion patient) async { if (orderProcedures.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getOrderProcedures(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -152,7 +158,7 @@ class UcafViewModel extends BaseViewModel { Future getPrescription(PatiantInformtion patient) async { if (prescriptionList == null) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPrescription(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -190,7 +196,7 @@ class UcafViewModel extends BaseViewModel { } Future postUCAF(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.postUCAF(patient); if (_ucafService.hasError) { error = _ucafService.error; diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index fb96a61a..b576b7a4 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -23,8 +23,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' - as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -61,13 +60,13 @@ class ProcedureViewModel extends BaseViewModel { List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); - Future getProcedure({int mrn, String patientType}) async { + Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; await getDoctorProfile(); //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.getProcedure(mrn: mrn); + await _procedureService.getProcedure(mrn: mrn, appointmentNo: appointmentNo); if (_procedureService.hasError) { error = _procedureService.error; if (patientType == "7") @@ -78,15 +77,12 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory( - {String categoryName, String categoryID, patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { if (categoryName == null) return; hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, - categoryID: categoryID, - patientId: patientId); + categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -321,8 +317,7 @@ class ProcedureViewModel extends BaseViewModel { List entityList, ProcedureType procedureType}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel(); procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo; @@ -337,21 +332,13 @@ class ProcedureViewModel extends BaseViewModel { procedureValadteRequestModel.procedure = [element.procedureId]; List controls = List(); controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), + Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: procedureType == ProcedureType.PROCEDURE - ? element.type ?? "1" - : "0"), + Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); + controlsProcedure + .add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls)); }); postProcedureReqModel.procedures = controlsProcedure; @@ -371,8 +358,7 @@ class ProcedureViewModel extends BaseViewModel { Helpers.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { - Helpers.showErrorToast( - valadteProcedureList[0].entityList[0].warringMessages); + Helpers.showErrorToast(valadteProcedureList[0].entityList[0].warringMessages); } } } else { diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 5bce4f71..72b5c857 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/home/home_screen.dart'; import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart'; diff --git a/lib/models/doctor/replay/request_doctor_reply.dart b/lib/models/doctor/replay/request_doctor_reply.dart index 1c3948cb..82384586 100644 --- a/lib/models/doctor/replay/request_doctor_reply.dart +++ b/lib/models/doctor/replay/request_doctor_reply.dart @@ -15,6 +15,7 @@ class RequestDoctorReply { bool patientOutSA; int pageIndex; int pageSize; + int infoStatus; RequestDoctorReply( {this.projectID, @@ -30,6 +31,7 @@ class RequestDoctorReply { this.isLoginForDoctorApp, this.patientOutSA, this.pageIndex, + this.infoStatus, this.pageSize}); RequestDoctorReply.fromJson(Map json) { @@ -47,6 +49,7 @@ class RequestDoctorReply { patientOutSA = json['PatientOutSA']; pageIndex = json['PageIndex']; pageSize = json['PageSize']; + pageSize = json['InfoStatus']; } Map toJson() { @@ -65,6 +68,8 @@ class RequestDoctorReply { data['PatientOutSA'] = this.patientOutSA; data['PageIndex'] = this.pageIndex; data['PageSize'] = this.pageSize; + if(this.infoStatus != null) + data['InfoStatus'] = this.infoStatus; return data; } } diff --git a/lib/routes.dart b/lib/routes.dart index 742ac118..712db98c 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -3,8 +3,6 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; 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'; @@ -22,6 +20,7 @@ import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import './screens/auth/login_screen.dart'; +import 'screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; @@ -109,8 +108,8 @@ var routes = { ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), ORDER_PROCEDURE: (_) => ProcedureScreen(), MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), - PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), - PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), + PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(), + // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), }; diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index f5893836..85c5090a 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -460,7 +460,7 @@ class _VerificationMethodsScreenState extends State { if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.hideDialog(context); - this.startSMSService(authMethodType); + this.startSMSService(authMethodType,isSilentLogin: true); } else { checkActivationCode(isSilentLogin: true); } @@ -503,7 +503,7 @@ class _VerificationMethodsScreenState extends State { } } - startSMSService(AuthMethodTypes type) { + startSMSService(AuthMethodTypes type,{isSilentLogin: false}) { new SMSOTP( context, type, @@ -515,7 +515,7 @@ class _VerificationMethodsScreenState extends State { return AppLoaderWidget(); }); - this.checkActivationCode(value: value,isSilentLogin: false); + this.checkActivationCode(value: value,isSilentLogin: isSilentLogin); }, () => { diff --git a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart new file mode 100644 index 00000000..5166d2b1 --- /dev/null +++ b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart @@ -0,0 +1,95 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_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/screens/doctor/doctor_replay/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +import 'doctor_repaly_chat.dart'; + +class AllDoctorQuestions extends StatefulWidget { + final Function changeCurrentTab; + + const AllDoctorQuestions({Key key, this.changeCurrentTab}) : super(key: key); + + @override + _AllDoctorQuestionsState createState() => _AllDoctorQuestionsState(); +} + +class _AllDoctorQuestionsState extends State { + + int pageIndex = 1; + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getDoctorReply(isLocalBusy: false); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: model.listDoctorWorkingHoursTable.isEmpty + ?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) + : Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: NotificationListener( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.listDoctorWorkingHoursTable.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return Column( + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat( + reply: + model.listDoctorWorkingHoursTable[ + index], + previousModel: model, + ), + settings: RouteSettings( + name: 'DoctorReplayChat'), + )); + }, + child: DoctorReplyWidget( + reply: model + .listDoctorWorkingHoursTable[index]), + ), + if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) + DrAppCircularProgressIndeicator() + + ], + ); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && + model.state != ViewState.BusyLocal) { + setState(() { + pageIndex++; + }); + model.getDoctorReply(pageIndex: pageIndex); + } + return; + }, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart similarity index 97% rename from lib/screens/doctor/doctor_repaly_chat.dart rename to lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart index 72f13d4e..52331e8e 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart @@ -187,7 +187,7 @@ class _DoctorReplayChatState extends State { children: [ AppText( - widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.createdOn !=null?getFormattedDate(widget.reply.createdOn):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Colors.white, @@ -295,7 +295,7 @@ class _DoctorReplayChatState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - widget.reply.responseDate !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.responseDate)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.responseDate !=null?getFormattedDate(widget.reply.responseDate):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Color(0xFF2B353E), @@ -445,4 +445,24 @@ class _DoctorReplayChatState extends State { ), )); } + + + getFormattedDate(date){ + return (AppDateUtils.getDateTimeFromServerFormat( + date) + .day + .toString() + + " " + + AppDateUtils.getMonth( + AppDateUtils.getDateTimeFromServerFormat( + date) + .month) + .toString() + .substring(0, 3) + + ' ' + + AppDateUtils.getDateTimeFromServerFormat( + date) + .year + .toString()); + } } diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart new file mode 100644 index 00000000..8b51319c --- /dev/null +++ b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart @@ -0,0 +1,185 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_repaly_chat.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_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/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'all_doctor_questions.dart'; +import 'not_replaied_Doctor_Questions.dart'; + +/* + *@author: Mohammad Aljammal + *@Date:28/4/2020 + *@param: + *@return: + *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service + */ +class DoctorReplyScreen extends StatefulWidget { + final Function changeCurrentTab; + + const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key); + + @override + _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); +} + +class _DoctorReplyScreenState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + int _activeTab = 0; + int pageIndex = 1; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return WillPopScope( + onWillPop: () async { + widget.changeCurrentTab(); + return false; + }, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Scaffold( + extendBodyBehindAppBar: false, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + "Not Replied", + ), + tabWidget( + screenSize, + _activeTab == 1, + TranslationBase.of(context).all, + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + NotRepliedDoctorQuestions(), + AllDoctorQuestions(), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} + +Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); +} diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart similarity index 81% rename from lib/widgets/doctor/doctor_reply_widget.dart rename to lib/screens/doctor/doctor_replay/doctor_reply_widget.dart index 599e4e37..69bb9ab2 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart @@ -31,14 +31,20 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( - bgColor: - widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), + bgColor: widget.reply.infoStatus == 99 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], hasBorder: false, widget: Container( child: InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(widget.reply.infoStatus != 0) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -49,18 +55,32 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: widget.reply.status == 2 - ? TranslationBase.of(context).active - : widget.reply.status == 1 - ? TranslationBase.of(context).onHold - : TranslationBase.of(context).cancelled, + text: widget.reply.infoStatus == 99 + ? TranslationBase.of(context).notReplied:widget.reply.infoStatus == 1 + ? TranslationBase.of(context).replayCallStatus + : widget.reply.infoStatus == 2 + ? TranslationBase.of(context).patientArrived + : widget.reply.infoStatus == 3 + ? TranslationBase.of(context) + .calledAndNoResponse + : widget.reply.infoStatus == 4 + ? TranslationBase.of(context) + .underProcess + : widget.reply.infoStatus == 6 + ? TranslationBase.of(context) + .textResponse + : '', style: TextStyle( - color: widget.reply.status == 2 - ? Colors.green[600] - : Color(0xFFD02127), + color: widget.reply.infoStatus == 99 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 2.0 * SizeConfig.textMultiplier)), + fontSize: 1.8 * SizeConfig.textMultiplier)), ], ), ), @@ -182,38 +202,16 @@ class _DoctorReplyWidgetState extends State { CustomRow( label: TranslationBase.of(context).fileNumber, value: widget.reply.patientID.toString(), + isCopyable:false, ), - CustomRow( label: TranslationBase.of(context).age + " : ", + isCopyable:false, value: "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", ), - CustomRow( - width: MediaQuery.of(context).size.width * .3, - label: TranslationBase.of(context).infoStatus + - ":", - value: widget.reply.infoStatus == 1 - ? TranslationBase.of(context) - .replayCallStatus - : widget.reply.infoStatus == 2 - ? TranslationBase.of(context) - .patientArrived - : widget.reply.infoStatus == 3 - ? TranslationBase.of(context) - .calledAndNoResponse - : widget.reply.infoStatus == 4 - ? TranslationBase.of(context) - .underProcess - : widget.reply.infoStatus == 6 - ? TranslationBase.of( - context) - .textResponse - : '', - ), - SizedBox( - height: 10, + height: 8, ), ], ), @@ -227,27 +225,28 @@ class _DoctorReplyWidgetState extends State { overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( - fontSize: - 1.3 * SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .requestType + - ": ", + text: + TranslationBase.of(context).requestType + + ": ", style: TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( text: - "${widget.reply.requestTypeDescription}", + "${widget.reply.requestTypeDescription}", style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), diff --git a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart new file mode 100644 index 00000000..5b21809f --- /dev/null +++ b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart @@ -0,0 +1,104 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_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/screens/doctor/doctor_replay/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +import 'doctor_repaly_chat.dart'; + +class NotRepliedDoctorQuestions extends StatefulWidget { + final Function changeCurrentTab; + + const NotRepliedDoctorQuestions({Key key, this.changeCurrentTab}) + : super(key: key); + + @override + _NotRepliedDoctorQuestionsState createState() => + _NotRepliedDoctorQuestionsState(); +} + +class _NotRepliedDoctorQuestionsState extends State { + int pageIndex = 1; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getDoctorReply(isLocalBusy: false, isGettingNotReply: true); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: model.listDoctorNotRepliedQuestions.isEmpty + ? ErrorMessage(error: TranslationBase.of(context).noItem) + : Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: NotificationListener( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: + model.listDoctorNotRepliedQuestions.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return Column( + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat( + reply: model + .listDoctorNotRepliedQuestions[ + index], + previousModel: model, + ), + settings: RouteSettings( + name: 'DoctorReplayChat'), + )); + }, + child: DoctorReplyWidget( + reply: + model.listDoctorNotRepliedQuestions[ + index]), + ), + if (model.state == ViewState.BusyLocal && + index == + model.listDoctorNotRepliedQuestions + .length - + 1) + DrAppCircularProgressIndeicator() + ], + ); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && + t.metrics.pixels >= + t.metrics.maxScrollExtent - 50 && + model.state != ViewState.BusyLocal) { + setState(() { + pageIndex++; + }); + model.getDoctorReply(pageIndex: pageIndex, isGettingNotReply: true); + } + return; + }, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart deleted file mode 100644 index 0f310c64..00000000 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/doctor/doctor_repaly_chat.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/doctor/doctor_reply_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/dr_app_circular_progress_Indeicator.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -/* - *@author: Mohammad Aljammal - *@Date:28/4/2020 - *@param: - *@return: - *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service - */ -class DoctorReplyScreen extends StatefulWidget { - final Function changeCurrentTab; - - const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key); - - @override - _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); -} - -class _DoctorReplyScreenState extends State { - int pageIndex = 1; - - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) { - model.getDoctorReply(isLocalBusy: false); - }, - builder: (_, model, w) => WillPopScope( - onWillPop: () async { - widget.changeCurrentTab(); - return false; - }, - child: AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).replay2, - isShowAppBar: false, - body: model.listDoctorWorkingHoursTable.isEmpty - ? DrAppEmbeddedError(error: TranslationBase.of(context).noItem) - : Column( - children: [ - Expanded( - child: Container( - padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - child: NotificationListener( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: model.listDoctorWorkingHoursTable.length, - shrinkWrap: true, - itemBuilder: (BuildContext ctxt, int index) { - return Column( - children: [ - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - DoctorReplayChat( - reply: - model.listDoctorWorkingHoursTable[ - index], - previousModel: model, - ), - settings: RouteSettings( - name: 'DoctorReplayChat'), - )); - }, - child: DoctorReplyWidget( - reply: model - .listDoctorWorkingHoursTable[index]), - ), - if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) - DrAppCircularProgressIndeicator() - - ], - ); - }), - onNotification: (t) { - if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && - model.state != ViewState.BusyLocal) { - setState(() { - pageIndex++; - }); - model.getDoctorReply(pageIndex: pageIndex); - } - return; - }, - ), - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart deleted file mode 100644 index 960bbdd9..00000000 --- a/lib/screens/doctor/my_referral_patient_screen.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/referral_view_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/doctor/my_referral_patient_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/shared/app_scaffold_widget.dart'; - -class MyReferralPatient extends StatefulWidget { - int expandedItemIndex = -1; - - @override - _MyReferralPatientState createState() => _MyReferralPatientState(); -} - -class _MyReferralPatientState extends State { - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getMyReferralPatient(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).myReferralPatient, - body: model.listMyReferralPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.listMyReferralPatientModel.length, - (index) => MyReferralPatientWidget( - myReferralPatientModel: model - .listMyReferralPatientModel[index], - model: model, - expandClick: () { - setState(() { - if (widget.expandedItemIndex == - index) { - widget.expandedItemIndex = -1; - } else { - widget.expandedItemIndex = index; - } - }); - }, - isExpand: - widget.expandedItemIndex == index, - ), - ) - ], - ), - ), - ], - ), - ], - ), - ), - )); - } -} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 32a842d3..93fe0a21 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -12,7 +12,7 @@ import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; import 'package:doctor_app_flutter/screens/home/home_patient_card.dart'; import 'package:doctor_app_flutter/screens/live_care/live_care_patient_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/in_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; @@ -371,7 +371,7 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen( + page: InPatientScreen( specialClinic: model.getSpecialClinic( clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), ), diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 7f314c0e..8fba00d0 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -323,7 +323,11 @@ class _DischargedPatientState extends State { ), ], ), - ) + ), + Icon( + Icons.arrow_forward, + size: 24, + ), ], ) ], diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart deleted file mode 100644 index 8314a653..00000000 --- a/lib/screens/patients/InPatientPage.dart +++ /dev/null @@ -1,213 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.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/patient_card/PatientCard.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -import '../../routes.dart'; - -class InPatientPage extends StatefulWidget { - final bool isMyInPatient; - final PatientSearchViewModel patientSearchViewModel; - - InPatientPage(this.isMyInPatient, this.patientSearchViewModel); - - @override - _InPatientPageState createState() => _InPatientPageState(); -} - -class _InPatientPageState extends State { - - TextEditingController _searchController = TextEditingController(); - - bool isSortDes = false; - - @override - void dispose() { - _searchController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - baseViewModel: widget.patientSearchViewModel, - isShowAppBar: false, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Container( - margin: EdgeInsets.all(16.0), - child: Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - widget.patientSearchViewModel.filterSearchResults(value); - }), - - Positioned( - right: 35, - top:5, - child: IconButton( - icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, - color: Colors.black, - ), - iconSize: 20, - // padding: EdgeInsets.only(bottom: 30), - onPressed: () { - GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); - isSortDes = !isSortDes; - GifLoaderDialogUtils.hideDialog(context); - }, - ), - ) - ], - ), - ), - widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? (widget.isMyInPatient && widget.patientSearchViewModel.myIinPatientList.length ==0 )?NoData():Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate( - widget.patientSearchViewModel.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel. - filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else if (widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], - ), - ), - ), - ) - : NoData(): Center( - child: Container( - height: 300, - width: 300, - - ), - ), - ], - ), - ); - } -} - -class NoData extends StatelessWidget { - const NoData({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: - TranslationBase.of(context).noDataAvailable)), - ), - ); - } -} diff --git a/lib/screens/patients/In_patient/InPatientHeader.dart b/lib/screens/patients/In_patient/InPatientHeader.dart new file mode 100644 index 00000000..a8ef8b10 --- /dev/null +++ b/lib/screens/patients/In_patient/InPatientHeader.dart @@ -0,0 +1,42 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class InPatientHeader extends StatelessWidget with PreferredSizeWidget{ + const InPatientHeader() : super(); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + Expanded( + child: AppText( + TranslationBase + .of(context) + .inPatient, + fontSize: SizeConfig.textMultiplier * 2.8, + fontWeight: FontWeight.bold, + color: Color(0xFF2B353E), + ), + ), + ]), + ), + ); + } + + @override + Size get preferredSize => Size(double.maxFinite,85); +} \ No newline at end of file diff --git a/lib/screens/patients/In_patient/NoData.dart b/lib/screens/patients/In_patient/NoData.dart new file mode 100644 index 00000000..0c48cd2a --- /dev/null +++ b/lib/screens/patients/In_patient/NoData.dart @@ -0,0 +1,20 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +class NoData extends StatelessWidget { + const NoData({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart new file mode 100644 index 00000000..84c54a6e --- /dev/null +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -0,0 +1,311 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import 'NoData.dart'; +import 'list_of_all_in_patient.dart'; +import 'list_of_my_inpatient.dart'; + +class InPatientListPage extends StatefulWidget { + final bool isMyInPatient; + final PatientSearchViewModel patientSearchViewModel; + + InPatientListPage(this.isMyInPatient, this.patientSearchViewModel); + + @override + _InPatientListPageState createState() => _InPatientListPageState(); +} + +class _InPatientListPageState extends State { + TextEditingController _searchController = TextEditingController(); + + bool isSortDes = false; + bool isAllClinic = true; + bool hasQuery = false; + bool showBottomSheet = false; + String selectedClinicName; + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + baseViewModel: widget.patientSearchViewModel, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!widget.isMyInPatient) + Container( + margin: EdgeInsets.only(left: 10.0, right: 10, top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Radio( + value: 1, + groupValue: isAllClinic ? 1 : 2, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = true; + showBottomSheet = false; + selectedClinicName = null; + }); + widget.patientSearchViewModel + .setDefaultInPatientList(); + }); + }, + activeColor: Colors.red, + ), + AppText( + "${TranslationBase.of(context).allClinic}", + fontSize: 15, + ), + ], + ), + onTap: () { + setState(() { + isAllClinic = true; + selectedClinicName = null; + showBottomSheet = false; + }); + widget.patientSearchViewModel.setDefaultInPatientList(); + }, + ), + InkWell( + onTap: () { + setState(() { + + if (widget.patientSearchViewModel.InpatientClinicList + .length > + 0) showBottomSheet = true; + }); + }, + child: Row( + children: [ + Radio( + value: 2, + groupValue: isAllClinic ? 1 : 2, + onChanged: (value) { + setState(() { + setState(() { + if (widget.patientSearchViewModel + .InpatientClinicList.length > + 0) showBottomSheet = true; + }); + }); + }, + activeColor: Colors.red, + ), + AppText( + selectedClinicName ?? TranslationBase.of(context).clinicSelect, + fontSize: 15, + ), + Container( + margin: EdgeInsets.only(bottom: 10), + child: Icon(FontAwesomeIcons.sortDown)) + ], + )), + ], + ), + ), + Container( + margin: EdgeInsets.only( + left: 16, + right: 16, + bottom: 16, + top: widget.isMyInPatient ? 15 : 5), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + controller: _searchController, + onChanged: (value) { + setState(() { + hasQuery = true; + }); + widget.patientSearchViewModel.filterSearchResults(value, + isAllClinic: isAllClinic, + isMyInPatient: widget.isMyInPatient); + }), + Positioned( + right: 35, + top: 5, + child: IconButton( + icon: Icon( + isSortDes + ? FontAwesomeIcons.sortAmountDown + : FontAwesomeIcons.sortAmountUp, + color: Colors.black, + ), + iconSize: 20, + // padding: EdgeInsets.only(bottom: 30), + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + widget.patientSearchViewModel.sortInPatient( + isDes: isSortDes, + isAllClinic: isAllClinic, + isMyInPatient: widget.isMyInPatient); + isSortDes = !isSortDes; + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ) + ], + ), + ), + widget.patientSearchViewModel.state == ViewState.Idle + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList.length > 0) + ? ListOfMyInpatient( + isAllClinic: isAllClinic, + hasQuery: hasQuery, + patientSearchViewModel: widget.patientSearchViewModel) + : widget.patientSearchViewModel.filteredInPatientItems + .length > + 0 + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList + .length == + 0) + ? NoData() + : ListOfAllInPatient( + isAllClinic: isAllClinic, + hasQuery: hasQuery, + patientSearchViewModel: + widget.patientSearchViewModel) + : NoData() + : Center( + child: Container( + height: 300, + width: 300, + ), + ), + ], + ), + bottomSheet: !showBottomSheet + ? Container( + height: 0, + ) + : Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + height: MediaQuery.of(context).size.height * 0.5, + padding: EdgeInsets.only(top: 13, left: 10, right: 10), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + setState(() { + showBottomSheet = false; + }); + }, + child: Icon(DoctorApp.close_1, + size: SizeConfig.getTextMultiplierBasedOnWidth() * + 4.5, + color: Color(0xFF2B353E))) + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).clinicSelect} :", + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 18, + ), + ], + ), + SizedBox( + height: 10, + ), + Expanded( + child: ListView.builder( + itemCount: widget + .patientSearchViewModel.InpatientClinicList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + setState(() { + isAllClinic = false; + showBottomSheet = false; + selectedClinicName = widget + .patientSearchViewModel + .InpatientClinicList[index]; + }); + widget.patientSearchViewModel.filterByClinic( + clinicName: widget.patientSearchViewModel + .InpatientClinicList[index]); + }, + child: Row( + children: [ + Radio( + value: widget.patientSearchViewModel + .InpatientClinicList[index], + groupValue: selectedClinicName, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = false; + showBottomSheet = false; + selectedClinicName = widget + .patientSearchViewModel + .InpatientClinicList[index]; + }); + widget.patientSearchViewModel + .filterByClinic(clinicName: value); + }); + }, + activeColor: Colors.red, + ), + AppText( + widget.patientSearchViewModel + .InpatientClinicList[index], + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ], + )); + }), + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart new file mode 100644 index 00000000..b959153f --- /dev/null +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -0,0 +1,273 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../DischargedPatientPage.dart'; +import 'in_patient_list_page.dart'; + +class InPatientScreen extends StatefulWidget { + GetSpecialClinicalCareListResponseModel specialClinic; + + InPatientScreen({Key key, this.specialClinic}); + + @override + _InPatientScreenState createState() => _InPatientScreenState(); +} + +class _InPatientScreenState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + int _activeTab = 0; + + int selectedMapId; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 3, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + PatientSearchRequestModel requestModel = PatientSearchRequestModel(); + ProjectViewModel projectsProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + model.clearPatientList(); + if (widget.specialClinic != null) { + await model + .getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + requestModel.nursingStationID = + model.specialClinicalCareMappingList[0].nursingStationID; + } + requestModel.clinicID = 0; + await model.getInPatientList(requestModel); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: InPatientHeader(), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null && + _activeTab != 2) + Container( + width: MediaQuery.of(context).size.width * .3, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null + ? model.specialClinicalCareMappingList[0].nursingStationID + : selectedMapId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model.specialClinicalCareMappingList.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(2), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + model + .specialClinicalCareMappingList.length + .toString(), + color: Colors.white, + fontSize: + projectsProvider.isArabic ? 10 : 11, + textAlign: TextAlign.center, + ), + )), + ], + ), + AppText(item.description, + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + selectedMapId = newValue; + }); + model.clearPatientList(); + GifLoaderDialogUtils.showMyDialog(context); + + PatientSearchRequestModel requestModel = + PatientSearchRequestModel( + nursingStationID: selectedMapId, clinicID: 0); + await model.getInPatientList(requestModel, + isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + items: model.specialClinicalCareMappingList.map((item) { + return DropdownMenuItem( + child: AppText( + item.description, + textAlign: TextAlign.left, + ), + value: item.nursingStationID, + ); + }).toList(), + )), + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: false, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget(screenSize, _activeTab == 0, + TranslationBase.of(context).inPatientAll, + counter: model.inPatientList.length), + tabWidget(screenSize, _activeTab == 1, + TranslationBase.of(context).myInPatientTitle, + counter: model.myIinPatientList.length), + tabWidget(screenSize, _activeTab == 2, + TranslationBase.of(context).discharged), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + InPatientListPage(false, model), + InPatientListPage(true, model), + DischargedPatient(), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart new file mode 100644 index 00000000..169e9da6 --- /dev/null +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -0,0 +1,85 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:flutter/material.dart'; + +import '../../../routes.dart'; +import 'NoData.dart'; + +class ListOfAllInPatient extends StatelessWidget { + const ListOfAllInPatient({ + Key key, + @required this.isAllClinic, + @required this.hasQuery, + this.patientSearchViewModel, + }) : super(key: key); + + final bool isAllClinic; + final bool hasQuery; + + + final PatientSearchViewModel patientSearchViewModel; + + @override + Widget build(BuildContext context) { + return Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: patientSearchViewModel.filteredInPatientItems.length == 0 + ? NoData() + : NotificationListener( + child: ListView.builder( + itemCount: + patientSearchViewModel.filteredInPatientItems.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (context, index) { + return PatientCard( + patientInfo: patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: patientSearchViewModel + .filteredInPatientItems[index].doctorId == + patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": patientSearchViewModel + .filteredInPatientItems[index].doctorId == + patientSearchViewModel.doctorProfile.doctorID, + }); + }, + ); + }), + onNotification: (notification) { + if (isAllClinic && !hasQuery) if (notification + is ScrollUpdateNotification) { + if (notification.metrics.pixels >= notification.metrics.maxScrollExtent - 50) { + patientSearchViewModel.addOnFilteredList(); + } + + if (notification.metrics.pixels <= notification.metrics.minScrollExtent - 50) { + patientSearchViewModel.removeOnFilteredList(); + } + } + return; + }, + ), + ), + ); + } +} diff --git a/lib/screens/patients/In_patient/list_of_my_inpatient.dart b/lib/screens/patients/In_patient/list_of_my_inpatient.dart new file mode 100644 index 00000000..f5f7c070 --- /dev/null +++ b/lib/screens/patients/In_patient/list_of_my_inpatient.dart @@ -0,0 +1,66 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:flutter/material.dart'; + +import '../../../routes.dart'; +import 'NoData.dart'; +class ListOfMyInpatient extends StatelessWidget { + const ListOfMyInpatient({ + Key key, + @required this.isAllClinic, + @required this.hasQuery, + this.patientSearchViewModel, + }) : super(key: key); + + final bool isAllClinic; + final bool hasQuery; + final PatientSearchViewModel patientSearchViewModel; + + @override + Widget build(BuildContext context) { + return Expanded( + child:Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: patientSearchViewModel.filteredMyInPatientItems.length == 0 + ? NoData():NotificationListener( + child: ListView.builder( + itemCount: patientSearchViewModel.filteredMyInPatientItems.length, + scrollDirection: Axis.vertical, + // physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return PatientCard( + patientInfo: patientSearchViewModel.filteredMyInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: true, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": + patientSearchViewModel.filteredMyInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": true, + }); + }, + ); + }), + onNotification: (t) { + return; + }, + ), + ), + ); + } +} diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart deleted file mode 100644 index f094f71a..00000000 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ /dev/null @@ -1,329 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -import 'DischargedPatientPage.dart'; -import 'InPatientPage.dart'; - -class PatientInPatientScreen extends StatefulWidget { - GetSpecialClinicalCareListResponseModel specialClinic; - - PatientInPatientScreen({Key key, this.specialClinic}); - - @override - _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); -} - -class _PatientInPatientScreenState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - int _activeTab = 0; - - int selectedMapId; - - - @override - void initState() { - super.initState(); - _tabController = TabController(length: 3, vsync: this); - _tabController.addListener(_handleTabSelection); - } - - @override - void dispose() { - super.dispose(); - _tabController.dispose(); - } - - _handleTabSelection() { - setState(() { - _activeTab = _tabController.index; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - PatientSearchRequestModel requestModel = PatientSearchRequestModel(); - ProjectViewModel projectsProvider = Provider.of(context); - - - return BaseView( - onModelReady: (model) async { - model.clearPatientList(); - if (widget.specialClinic != null) { - await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); - requestModel.nursingStationID = - model.specialClinicalCareMappingList[0].nursingStationID; - - } - requestModel.clinicID = 0; - await model.getInPatientList(requestModel); - }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - TranslationBase - .of(context) - .inPatient, - fontSize: SizeConfig.textMultiplier * 2.8, - fontWeight: FontWeight.bold, - color: Color(0xFF2B353E), - ), - ), - if (model.specialClinicalCareMappingList.isNotEmpty && - widget.specialClinic != null && - _activeTab != 2) - Container( - width: MediaQuery.of(context).size.width * .3, - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - isExpanded: true, - value: selectedMapId == null ? model - .specialClinicalCareMappingList[0] - .nursingStationID : selectedMapId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .specialClinicalCareMappingList - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .center, - children: [ - Container( - padding: - EdgeInsets.all(2), - margin: - EdgeInsets.all(2), - decoration: - new BoxDecoration( - color: - Colors.red[800], - borderRadius: - BorderRadius - .circular( - 20), - ), - constraints: - BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: Center( - child: AppText( - model - .specialClinicalCareMappingList - .length - .toString(), - color: - Colors.white, - fontSize: - projectsProvider - .isArabic - ? 10 - : 11, - textAlign: - TextAlign - .center, - ), - )), - ], - ), - AppText(item.description, - fontSize: 12, - color: Colors.black, - fontWeight: - FontWeight.bold, - textAlign: TextAlign.end), - ], - ); - }).toList(); - }, - onChanged: (newValue) async { - setState(() { - selectedMapId = newValue; - }); - model.clearPatientList(); - GifLoaderDialogUtils.showMyDialog( - context); - - PatientSearchRequestModel requestModel = PatientSearchRequestModel( - nursingStationID: selectedMapId, clinicID: 0); - await model.getInPatientList(requestModel, isLocalBusy: true); - GifLoaderDialogUtils.hideDialog( - context); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - }, - items: model - .specialClinicalCareMappingList - .map((item) { - return DropdownMenuItem( - child: AppText( - item.description, - textAlign: TextAlign.left, - ), - value: item.nursingStationID, - ); - }).toList(), - )), - ) - ]), - ), - ), - Expanded( - child: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight( - MediaQuery.of(context).size.height * 0.070), - child: Container( - height: MediaQuery.of(context).size.height * 0.070, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.5), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: false, - controller: _tabController, - indicatorColor: Colors.transparent, - indicatorWeight: 1.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only( - top: 0, left: 0, right: 0, bottom: 0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - tabWidget(screenSize, _activeTab == 0, - TranslationBase.of(context).inPatientAll, - counter: model.inPatientList.length), - tabWidget( - screenSize, _activeTab == 1, TranslationBase.of(context).inPatient, - counter: model.myIinPatientList.length), - tabWidget(screenSize, _activeTab == 2, - TranslationBase.of(context).discharged), - ], - ), - ), - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - InPatientPage(false, model), - InPatientPage(true,model), - DischargedPatient(), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - Widget tabWidget(Size screenSize, bool isActive, String title, - {int counter = -1}) { - return Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), - isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - title, - fontSize: SizeConfig.textMultiplier * 1.5, - color: isActive ? Colors.white : Color(0xFF2B353E), - fontWeight: FontWeight.w700, - ), - if (counter != -1) - Container( - margin: EdgeInsets.all(4), - width: 15, - height: 15, - decoration: BoxDecoration( - color: isActive ? Colors.white : Color(0xFFD02127), - shape: BoxShape.circle, - ), - child: Center( - child: FittedBox( - child: AppText( - "$counter", - fontSize: SizeConfig.textMultiplier * 1.5, - color: !isActive ? Colors.white : Color(0xFFD02127), - fontWeight: FontWeight.w700, - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/screens/patients/patient_search/patient_search_header.dart b/lib/screens/patients/patient_search/patient_search_header.dart index b9afab7d..7df6905f 100644 --- a/lib/screens/patients/patient_search/patient_search_header.dart +++ b/lib/screens/patients/patient_search/patient_search_header.dart @@ -38,6 +38,5 @@ class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget { } @override - Size get preferredSize => Size(double.maxFinite,65); } diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 081f1a6e..ea4511e3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/order-procedure.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/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -22,34 +23,63 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UcafDetailScreen extends StatefulWidget { + final PatiantInformtion patient; + final UcafViewModel model; + final Function changeLoadingState; + + UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); + @override - _UcafDetailScreenState createState() => _UcafDetailScreenState(); + _UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model); } class _UcafDetailScreenState extends State { + + final PatiantInformtion patient; + final UcafViewModel model; + + UcafViewModel ucafModel; + int _activeTap = 0; + _UcafDetailScreenState(this.patient, this.model); + @override - 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']; + void initState() { + model.saveUCAFOnTap = () async{ + widget.changeLoadingState(true); + await ucafModel.postUCAF(patient); + widget.changeLoadingState(false); + if (ucafModel.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .postUcafSuccessMsg); + Navigator.of(context).popUntil((route) { + return route.settings.name == + PATIENTS_PROFILE; + }); + } else { + DrAppToastMsg.showErrorToast(ucafModel.error); + } + }; + super.initState(); + } + @override + Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async { - model.resetDataInFirst(); + ucafModel = model; + model.resetDataInFirst(firstPage: false); await model.getLanguage(); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: Column( children: [ Expanded( @@ -58,35 +88,6 @@ class _UcafDetailScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 2, - screenSize: screenSize, - ), - SizedBox( - height: 10, - ), Container( margin: EdgeInsets.symmetric( vertical: 16, horizontal: 16), @@ -107,64 +108,7 @@ class _UcafDetailScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - child: Row( - children: [ - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).cancel, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: Colors.white, - color: Colors.white, - fontColor: HexColor("#B8382B"), - fontSize: 2.2, - onPressed: () { - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - }, - ), - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).save, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: HexColor("#B8382B"), - color: HexColor("#B8382B"), - fontColor: Colors.white, - fontSize: 2.0, - onPressed: () async { - await model.postUCAF(patient); - if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .postUcafSuccessMsg); - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - } else { - DrAppToastMsg.showErrorToast(model.error); - } - }, - ), - ), - ), - ], - ), - ), + ], ), )); @@ -210,12 +154,18 @@ class _UcafDetailScreenState extends State { onTap: () async { print(__treatmentSteps.indexOf(item)); if (__treatmentSteps.indexOf(item) == 0) { + widget.changeLoadingState(true); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); } else if (__treatmentSteps.indexOf(item) == 1) { + widget.changeLoadingState(true); await model.getPrescription(patient); + widget.changeLoadingState(false); } if (__treatmentSteps.indexOf(item) == 2) { + widget.changeLoadingState(true); await model.getOrderProcedures(patient); + widget.changeLoadingState(false); } setState(() { _activeTap = __treatmentSteps.indexOf(item); @@ -234,10 +184,15 @@ class _UcafDetailScreenState extends State { case 0: if (model.patientAssessmentList != null) { return [ - ...List.generate( - model.patientAssessmentList.length, - (index) => DiagnosisWidget( - model, model.patientAssessmentList[index])).toList() + ListView.builder( + itemCount: model.patientAssessmentList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return DiagnosisWidget( + model, model.patientAssessmentList[index]); + }) ]; } else { return [ @@ -247,22 +202,30 @@ class _UcafDetailScreenState extends State { break; case 1: return [ - ...List.generate( - model.prescriptionList != null + ListView.builder( + itemCount: model.prescriptionList != null ? model.prescriptionList.entityList.length : 0, - (index) => MedicationWidget( - model, model.prescriptionList.entityList[index])).toList() + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return MedicationWidget( + model, model.prescriptionList.entityList[index]); + }) ]; break; case 2: if (model.orderProcedures != null) { return [ - ...List.generate( - model.orderProcedures.length, - (index) => - ProceduresWidget(model, model.orderProcedures[index])) - .toList() + ListView.builder( + itemCount: model.orderProcedures.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return ProceduresWidget(model, model.orderProcedures[index]); + }) ]; } else { return [ @@ -276,6 +239,7 @@ class _UcafDetailScreenState extends State { ]; } } + } class DiagnosisWidget extends StatelessWidget { diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 3bbc6637..9960a1b3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -19,11 +19,20 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UCAFInputScreen extends StatefulWidget { + final PatiantInformtion patient; + final Function changeLoadingState; + + UCAFInputScreen(this.patient, {this.changeLoadingState}); + @override - _UCAFInputScreenState createState() => _UCAFInputScreenState(); + _UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient); } class _UCAFInputScreenState extends State { + final PatiantInformtion patient; + + _UCAFInputScreenState(this.patient); + bool _inPatient = false; bool _emergencyCase = false; final _durationOfIllnessController = TextEditingController(); @@ -53,21 +62,15 @@ class _UCAFInputScreenState extends State { @override 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']; - - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getUCAFData(patient), + onModelReady: (model) async { + model.resetDataInFirst(); + await model.getUCAFData(patient); + widget.changeLoadingState(false); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: model.patientVitalSignsHistory.length > 0 && model.patientChiefComplaintList != null && model.patientChiefComplaintList.length > 0 @@ -79,31 +82,6 @@ class _UCAFInputScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 1, - screenSize: screenSize, - ), Container( margin: EdgeInsets.symmetric( vertical: 0, horizontal: 16), @@ -263,7 +241,7 @@ class _UCAFInputScreenState extends State { fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), - /* SizedBox( + /* SizedBox( height: 4, ), AppText( @@ -323,7 +301,7 @@ class _UCAFInputScreenState extends State { SizedBox( height: 8, ), - /* AppTextFieldCustom( + /* AppTextFieldCustom( hintText: TranslationBase.of(context).other, dropDownText: TranslationBase.of(context).none, enabled: false, @@ -400,21 +378,6 @@ class _UCAFInputScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#D02127"), - onPressed: () { - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, - arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType - }); - }, - ), - ), ], ) : Center( @@ -428,9 +391,10 @@ class _UCAFInputScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - model.patientVitalSignsHistory.length == 0 - ? TranslationBase.of(context).vitalSignEmptyMsg - : TranslationBase.of(context).chiefComplaintEmptyMsg, + model.patientVitalSignsHistory.length == 0 + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context) + .chiefComplaintEmptyMsg, fontWeight: FontWeight.normal, textAlign: TextAlign.center, color: HexColor("#B8382B"), diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart new file mode 100644 index 00000000..8c38ece7 --- /dev/null +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -0,0 +1,214 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/UCAF/page-stepper-widget.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/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import '../../../../routes.dart'; +import 'UCAF-detail-screen.dart'; +import 'UCAF-input-screen.dart'; + +class UCAFPagerScreen extends StatefulWidget { + const UCAFPagerScreen({Key key}) : super(key: key); + + @override + _UCAFPagerScreenState createState() => _UCAFPagerScreenState(); +} + +class _UCAFPagerScreenState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + bool _isLoading = true; + + PatiantInformtion patient; + String patientType; + String arrivalType; + + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + setState(() { + _currentIndex = pageIndex; + }); + } + + void changeLoadingState(bool isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + void initState() { + _controller = new PageController(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isLoading: _isLoading, + appBar: PatientProfileAppBar(patient), + appBarTitle: TranslationBase.of(context).ucaf, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientHeaderWidgetNoAvatar(patient), + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).patient}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + ), + AppText( + "${TranslationBase.of(context).ucaf}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + PageStepperWidget( + stepsCount: 2, + currentStepIndex: _currentIndex + 1, + screenSize: screenSize, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + UCAFInputScreen( + patient, + changeLoadingState: changeLoadingState, + ), + UcafDetailScreen( + patient, + model, + changeLoadingState: changeLoadingState, + ), + ]), + ), + ), + ], + ), + ), + ), + _isLoading + ? Container( + height: 0, + ) + : ucafButtons(model), + ], + ), + )); + } + + Widget ucafButtons(UcafViewModel model) { + switch (_currentIndex) { + case 0: + return Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: Color(0xFFD02127), + onPressed: () { + changePageViewIndex(1); + // Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: { + // 'patient': patient, + // 'patientType': patientType, + // 'arrivalType': arrivalType + // }); + }, + ), + ); + case 1: + return Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Colors.white, + color: Colors.white, + fontColor: Color(0xFFB8382B), + fontSize: 2.2, + onPressed: () { + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).save, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () { + model.saveUCAFOnTap(); + }, + ), + ), + ), + ], + ), + ); + default: + return Container(); + } + } +} diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index ecbaa919..153dfc6e 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -121,43 +121,6 @@ class LabResultWidget extends StatelessWidget { (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: - patientLabResultList[index].description, - patientLabOrder: patientLabOrder, - patient: patient, - isInpatient: isInpatient, - ), - // page: LabResultHistoryPage( - // filterName: patientLabResultList[index].description, - // patientLabOrder: patientLabOrder, - // patient: patient, - // ), - ), - ); - }, - // child: AppText( - // " (show details)", - // color: Colors.blue, - // fontSize: 12, - // ), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, - fontSize: 12, - ), - ], - ), - ), Row( children: [ Expanded( @@ -191,20 +154,67 @@ class LabResultWidget extends StatelessWidget { ), ), Expanded( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: AppText( - patientLabResultList[index].referanceRange, - textAlign: TextAlign.center, - isCopyable: true, + child: Column( + children: [ + Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + patientLabResultList[index].referanceRange, + textAlign: TextAlign.center, + isCopyable: true, + ), + ), ), - ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: + patientLabResultList[index].description, + patientLabOrder: patientLabOrder, + patient: patient, + isInpatient: isInpatient, + ), + // page: LabResultHistoryPage( + // filterName: patientLabResultList[index].description, + // patientLabOrder: patientLabOrder, + // patient: patient, + // ), + ), + ); + }, + // child: AppText( + // " (show details)", + // color: Colors.blue, + // fontSize: 12, + // ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).showMoreBtn, + textDecoration: TextDecoration.underline, + color: Colors.blue, + fontSize: 12, + ), + ], + ), + ) + ], ), ), ], ), + // SizedBox( + // height: 12, + // ), Divider(), ], )) diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 48c35952..2c6dbb0c 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrde 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/card_with_bg_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/cupertino.dart'; @@ -136,37 +137,44 @@ class _LabsHomePageState extends State { Radius.circular(8.0), ), color: Colors.white), - child: Row( + child: Stack( children: [ - Container( - width: 20, - height: 160, - decoration: BoxDecoration( - color: model.patientLabOrdersList[index].isLiveCareAppointment - ? Colors.red[900] - : !model.patientLabOrdersList[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)), + Positioned( + bottom: 1, + top: 1, + left: 1, + child: Container( + width: 20, + decoration: BoxDecoration( + color: model.patientLabOrdersList[index].isLiveCareAppointment + ? Colors.red[900] + : !model.patientLabOrdersList[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.patientLabOrdersList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !model.patientLabOrdersList[index].isInOutPatient + ? TranslationBase.of(context).inPatientLabel.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), + style: TextStyle(color: Colors.white), + ), + )), ), - child: RotatedBox( - quarterTurns: 3, - child: Center( - child: Text( - model.patientLabOrdersList[index].isLiveCareAppointment - ? TranslationBase.of(context).liveCare.toUpperCase() - : !model.patientLabOrdersList[index].isInOutPatient - ? TranslationBase.of(context).inPatientLabel.toUpperCase() - : TranslationBase.of(context).outpatient.toUpperCase(), - style: TextStyle(color: Colors.white), - ), - )), ), - Expanded( + Container( + color: Colors.white, + padding: EdgeInsets.all(0), + margin: EdgeInsets.only(left: 20), child: DoctorCard( isNoMargin: true, onTap: () => Navigator.push( diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 5df41821..0c66b493 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -212,7 +212,7 @@ class _PatientProfileScreenState extends State ), ], ), - if ((isInpatient) + if ((isInpatient && !isDischargedPatient) ? true : isFromLiveCare ? patient.episodeNo != null diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index cb6c1e5f..29697dc1 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -18,7 +18,8 @@ import 'my-referral-patient-screen.dart'; class MyReferralInPatientScreen extends StatefulWidget { @override - _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); + _MyReferralInPatientScreenState createState() => + _MyReferralInPatientScreenState(); } class _MyReferralInPatientScreenState extends State { @@ -76,51 +77,87 @@ class _MyReferralInPatientScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - if(patientType == PatientType.OUT_PATIENT) { - Navigator.push( - context, - FadePage( - page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]), - ), - ); - } else{ - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index], model), - ), - ); - } - - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode( - model.myReferralPatients[index].referralStatus, context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted( - model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic: "${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), - ), - ), - ), + ListView.builder( + itemCount: model.myReferralPatients.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + if (patientType == + PatientType.OUT_PATIENT) { + Navigator.push( + context, + FadePage( + page: MyReferralDetailScreen( + referralPatient: model + .myReferralPatients[index]), + ), + ); + } else { + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen( + model.myReferralPatients[index], + model), + ), + ); + } + }, + child: PatientReferralItemWidget( + referralStatus: + model.getReferralStatusNameByCode( + model.myReferralPatients[index] + .referralStatus, + context), + referralStatusCode: model + .myReferralPatients[index] + .referralStatus, + patientName: model + .myReferralPatients[index] + .patientName, + patientGender: model + .myReferralPatients[index].gender, + referredDate: AppDateUtils + .getDayMonthYearDateFormatted(model + .myReferralPatients[index] + .referralDate), + referredTime: AppDateUtils.getTimeHHMMA( + model.myReferralPatients[index] + .referralDate), + patientID: + "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic: + "${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index] + .referringDoctorRemarks, + nationality: model + .myReferralPatients[index] + .nationalityName, + nationalityFlag: model + .myReferralPatients[index] + .nationalityFlagURL, + doctorAvatar: model + .myReferralPatients[index] + .doctorImageURL, + referralDoctorName: model + .myReferralPatients[index] + .referringDoctorName, + clinicDescription: model + .myReferralPatients[index] + .referringClinicDescription, + infoIcon: Icon( + FontAwesomeIcons.arrowRight, + size: 25, + color: Colors.black), + ), + ); + }) ], ), ), diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 8dce7d60..354ee04f 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -13,7 +13,6 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ReferredPatientScreen extends StatefulWidget { - @override _ReferredPatientScreenState createState() => _ReferredPatientScreenState(); } @@ -69,79 +68,87 @@ class _ReferredPatientScreenState extends State { ), ) : Expanded( - child: SingleChildScrollView( + child: SingleChildScrollView( // DoctorApplication.svc/REST/GtMyReferredPatient child: Container( child: Column( children: [ - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen( - model.getReferredPatientItem(index), this.patientType), - ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model - .getReferredPatientItem(index) - .referralStatusDesc, - referralStatusCode: model - .getReferredPatientItem(index) - .referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: - model.getReferredPatientItem(index).gender, - referredDate: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "dd/MM/yyyy"), - referredTime: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "hh:mm a"), - patientID: - "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - isReferral: false, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - nationality: model - .getReferredPatientItem(index) - .nationalityName, - nationalityFlag: model - .getReferredPatientItem(index) - .nationalityFlagURL, - doctorAvatar: model - .getReferredPatientItem(index) - .doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), - ), + ListView.builder( + itemCount: + model.listMyReferredPatientModel.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen( + model.getReferredPatientItem(index), + this.patientType), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model + .getReferredPatientItem(index) + .referralStatusDesc, + referralStatusCode: model + .getReferredPatientItem(index) + .referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: model + .getReferredPatientItem(index) + .gender, + referredDate: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "dd/MM/yyyy"), + referredTime: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "hh:mm a"), + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + nationality: model + .getReferredPatientItem(index) + .nationalityName, + nationalityFlag: model + .getReferredPatientItem(index) + .nationalityFlagURL, + doctorAvatar: model + .getReferredPatientItem(index) + .doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), + ); + }, ), ], ), ), ), - ), + ), ], ), ), diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index a0cdb39c..53447743 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -1,7 +1,6 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.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/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart index 51afcd1f..8d29150e 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart @@ -21,7 +21,7 @@ class SOAPStepHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: SizeConfig.isHeightVeryShort?30: 15,), + SizedBox(height: SizeConfig.isHeightVeryShort?30:SizeConfig.isHeightShort?35: 15,), AppText( TranslationBase.of(context).createNew, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 3: 4), diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 553c2f17..db31fb95 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -1,7 +1,6 @@ // ignore: must_be_immutable import 'package:autocomplete_textfield/autocomplete_textfield.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/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 72579790..fd5e6b45 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -1,16 +1,9 @@ -import 'package:doctor_app_flutter/config/shared_pref_kay.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/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_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/soap_update/soap_utils.dart'; @@ -33,13 +26,18 @@ class UpdateSubjectivePage extends StatefulWidget { final int currentIndex; UpdateSubjectivePage( - {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); + {Key key, + this.changePageViewIndex, + this.patientInfo, + this.changeLoadingState, + this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); } -class _UpdateSubjectivePageState extends State implements SubjectiveCallBack { +class _UpdateSubjectivePageState extends State + implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -55,7 +53,8 @@ class _UpdateSubjectivePageState extends State implements widget.changeLoadingState(true); if (model.patientHistoryList.isNotEmpty) { model.patientHistoryList.forEach((element) { - if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, @@ -63,11 +62,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, @@ -75,11 +78,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, @@ -87,11 +94,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, @@ -99,7 +110,10 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -108,15 +122,19 @@ class _UpdateSubjectivePageState extends State implements } getAllergies(SOAPViewModel model) async { - if (model.patientAllergiesList.isNotEmpty) { model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( - masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); MasterKeyModel selectedAllergySeverity; if (element.severity == 0) { selectedAllergySeverity = MasterKeyModel( - id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + id: 0, + typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), + nameAr: '', + nameEn: ''); } else { selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, @@ -124,15 +142,17 @@ class _UpdateSubjectivePageState extends State implements ); } - MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy( - allergy: selectedAllergy, - isChecked: element.isChecked, - createdBy: element.createdBy, - remark: element.remarks, - isLocal: false, - allergySeverity: selectedAllergySeverity); + MySelectedAllergy mySelectedAllergy = + SoapUtils.generateMySelectedAllergy( + allergy: selectedAllergy, + isChecked: element.isChecked, + createdBy: element.createdBy, + remark: element.remarks, + isLocal: false, + allergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) + myAllergiesList.add(mySelectedAllergy); }); } } @@ -148,11 +168,14 @@ class _UpdateSubjectivePageState extends State implements if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); + complaintsController.text = Helpers.parseHtmlString( + model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text = !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty - ? model.patientChiefComplaintList[0].currentMedication + '\n \n' - : model.patientChiefComplaintList[0].currentMedication; + medicationController.text = + !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication + + '\n \n' + : model.patientChiefComplaintList[0].currentMedication; } if (widget.patientInfo.admissionNo == null) { await getHistory(model); @@ -200,7 +223,8 @@ class _UpdateSubjectivePageState extends State implements isExpanded: isChiefExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( @@ -212,12 +236,15 @@ class _UpdateSubjectivePageState extends State implements }); }, child: Column( - children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], + children: [ + UpdateHistoryWidget(myHistoryList: myHistoryList) + ], ), isExpanded: isHistoryExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( @@ -241,7 +268,8 @@ class _UpdateSubjectivePageState extends State implements isExpanded: isAllergiesExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), @@ -253,7 +281,9 @@ class _UpdateSubjectivePageState extends State implements } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { + {SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); @@ -265,22 +295,15 @@ class _UpdateSubjectivePageState extends State implements if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length > 25) { - await postChiefComplaint(model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - if (myHistoryList.length != 0) { - await postHistories(model: model, myHistoryList: myHistoryList); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - if (myAllergiesList.length != 0) { - await postAllergy(myAllergiesList: myAllergiesList, model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } + await model.postSubjectServices( + patientInfo: widget.patientInfo, + complaintsText: complaintsController.text, + medicationText: medicationController.text, + illnessText: illnessController.text, + myHistoryList: myHistoryList, + myAllergiesList: myAllergiesList, + ); + widget.changeLoadingState(true); widget.changePageViewIndex(1); @@ -311,112 +334,11 @@ class _UpdateSubjectivePageState extends State implements } } - postAllergy( - {List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = - new PostAllergyRequestModel(); - - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == - null) - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); - }); - if (model.patientAllergiesList.isEmpty) { - await model.postAllergy(postAllergyRequestModel); - } else { - await model.patchAllergy(postAllergyRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - doctorID: '', - editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy: true); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - - postHistories( - {List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = - new PostHistoriesRequestModel(doctorID: ''); - myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) - postHistoriesRequestModel.listMedicalHistoryVM = []; - postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: "", - historyId: history.selectedHistory.id, - historyType: history.selectedHistory.typeId, - isChecked: history.isChecked, - )); - }); - - if (model.patientHistoryList.isEmpty) { - await model.postHistories(postHistoriesRequestModel); - } else { - await model.patchHistories(postHistoriesRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - - postChiefComplaint({SOAPViewModel model}) async { - formKey.currentState.save(); - if (formKey.currentState.validate()) { - PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( - admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo ?? 0, - appointmentNo: widget.patientInfo.appointmentNo ?? 0, - chiefComplaint: complaintsController.text, - currentMedication: medicationController.text, - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - doctorID: '', - numberOfWeeks: 0); - if (model.patientChiefComplaintList.isEmpty) { - postChiefComplaintRequestModel.editedBy = ''; - await model.postChiefComplaint(postChiefComplaintRequestModel); - } else { - postChiefComplaintRequestModel.editedBy = ''; - await model.patchChiefComplaint(postChiefComplaintRequestModel); - } - } - } - @override Function nextFunction(model) { - addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); + addSubjectiveInfo( + model: model, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList); } } diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index fce49f77..84f38748 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -91,7 +91,8 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).direction, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.directionID.toString() ?? '')), + Expanded( + child: AppText(" " + prescriptions.directionDescription.toString() ?? '')), ], ), Row( @@ -100,7 +101,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).route, color: Colors.grey, ), - AppText(" " + prescriptions.routeId.toString() ?? ''), + AppText(" " + prescriptions.routeDescription.toString() ?? ''), ], ), Row( @@ -109,7 +110,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).refill, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.refillID.toString() ?? '')), + Expanded(child: AppText(" " + prescriptions.refillDescription.toString() ?? '')), ], ), Row( @@ -150,7 +151,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { 'UOM', color: Colors.grey, ), - AppText(" " + prescriptions.unitofMeasurement.toString() ?? ''), + AppText(" " + prescriptions.uomDescription.toString() ?? ''), ], ), Row( @@ -177,18 +178,18 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).processed, color: Colors.grey, ), - // AppText(" " + prescriptions.editedBy.toString() ?? ''), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).dailyDoses, - color: Colors.grey, - ), - AppText(" " + prescriptions.dose.toString() ?? ''), + AppText(" " + prescriptions.doctorName.toString() ?? ''), ], ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).num, + // color: Colors.grey, + // ), + // AppText(" " + prescriptions.dose.toString() ?? ''), + // ], + // ), SizedBox( height: 12, ), diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index e7225e9a..0c3c5123 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -196,7 +196,7 @@ class PrescriptionsPage extends StatelessWidget { appointmentDate: AppDateUtils.getDateTimeFromServerFormat( model.medicationForInPatient[index].prescriptionDatetime, ), - createdBy: model.medicationForInPatient[index].createdBy.toString(), + createdBy: model.medicationForInPatient[index].doctorName.toString(), )); }), if (model.medicationForInPatient.length == 0) diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 236ec5e2..7f4e49b2 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen. import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; @@ -46,10 +47,8 @@ class _AddFavouriteProcedureState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => - model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, baseViewModel: model, body: Column( @@ -57,97 +56,100 @@ class _AddFavouriteProcedureState extends State { Container( height: MediaQuery.of(context).size.height * 0.070, ), - if (model.templateList.length != 0) - Expanded( - child: EntityListCheckboxSearchFavProceduresWidget( - isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), - model: model, - removeFavProcedure: (item) { - setState(() { - entityList.remove(item); - }); - }, - addFavProcedure: (history) { - setState(() { - entityList.add(history); - }); - }, - isEntityFavListSelected: (master) => - isEntityListSelected(master), - groupProcedures: groupProcedures, - selectProcedures: (selectedProcedure) { - setState(() { - groupProcedures = selectedProcedure; - }); - }, - ), - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.procedureType.getAddButtonTitle(context) ?? - TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - if(widget.procedureType == ProcedureType.PRESCRIPTION){ - if (groupProcedures == null) { - DrAppToastMsg.showErrorToast( - 'Please Select item ', - ); - return; - } - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PrescriptionCheckOutScreen( - patient: widget.patient, - model: widget.prescriptionModel, - groupProcedures: groupProcedures, - ), settings: RouteSettings(name: 'PrescriptionCheckOutScreen') - ), - ); - } else { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ProcedureCheckOutScreen( - items: entityList, - model: model, - patient: widget.patient, - addButtonTitle: widget.procedureType.getAddButtonTitle(context), - toolbarTitle: widget.procedureType.getToolbarLabel(context), - ), settings: RouteSettings(name: 'ProcedureCheckOutScreen') - ), - ); - } - }, + (model.templateList.length != 0) + ? Expanded( + child: EntityListCheckboxSearchFavProceduresWidget( + isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), + model: model, + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + isEntityFavListSelected: (master) => isEntityListSelected(master), + groupProcedures: groupProcedures, + selectProcedures: (selectedProcedure) { + setState(() { + groupProcedures = selectedProcedure; + }); + }, + ), + ) + : Container( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 50.0), + child: AppText('You Don\'t have favorite prescription'), + ), ), - ], - ), - ), ], ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.procedureType.getAddButtonTitle(context) ?? + TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + disabled: model.templateList.length == 0 ? true : false, + fontWeight: FontWeight.w700, + onPressed: () { + if (widget.procedureType == ProcedureType.PRESCRIPTION) { + if (groupProcedures == null) { + DrAppToastMsg.showErrorToast( + 'Please Select item ', + ); + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionCheckOutScreen( + patient: widget.patient, + model: widget.prescriptionModel, + groupProcedures: groupProcedures, + ), + settings: RouteSettings(name: 'PrescriptionCheckOutScreen')), + ); + } else { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).fillTheMandatoryProcedureDetails, + ); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProcedureCheckOutScreen( + items: entityList, + model: model, + patient: widget.patient, + addButtonTitle: widget.procedureType.getAddButtonTitle(context), + toolbarTitle: widget.procedureType.getToolbarLabel(context), + ), + settings: RouteSettings(name: 'ProcedureCheckOutScreen')), + ); + } + }, + ), + ], + ), + ), ), ); } bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { Iterable history = entityList.where( - (element) => - masterKey.templateID == element.templateID && - masterKey.procedureName == element.procedureName); + (element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); if (history.length > 0) { return true; } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 3ca6d25d..de356935 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -35,12 +35,9 @@ class ProcedureScreen extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getProcedure( - mrn: patient.patientId, - patientType: patientType, - ), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => + model.getProcedure(mrn: patient.patientId, patientType: patientType, appointmentNo: patient.appointmentNo), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, @@ -56,8 +53,7 @@ class ProcedureScreen extends StatelessWidget { SizedBox( height: 12, ), - if (model.procedureList.length == 0 && - patient.patientStatusType != 43) + if (model.procedureList.length == 0 && patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -77,8 +73,7 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient.patientStatusType != null && patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -98,20 +93,19 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => BaseAddProcedureTabPage( - patient: patient, - model: model, - procedureType: ProcedureType.PROCEDURE, - ), settings: RouteSettings(name: 'AddProcedureTabPage') - ), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.PROCEDURE, + ), + settings: RouteSettings(name: 'AddProcedureTabPage')), ); }, child: Container( @@ -159,32 +153,21 @@ class ProcedureScreen extends StatelessWidget { ...List.generate( model.procedureList[0].rowcount, (index) => ProcedureCard( - categoryID: - model.procedureList[0].entityList[index].categoryID, + categoryID: model.procedureList[0].entityList[index].categoryID, entityList: model.procedureList[0].entityList[index], onTap: () { - if (model.procedureList[0].entityList[index].categoryID == - 2 || + if (model.procedureList[0].entityList[index].categoryID == 2 || model.procedureList[0].entityList[index].categoryID == 4) updateProcedureForm(context, model: model, patient: patient, - remarks: model - .procedureList[0].entityList[index].remarks, - orderType: model - .procedureList[0].entityList[index].orderType - .toString(), - orderNo: model - .procedureList[0].entityList[index].orderNo, - procedureName: model.procedureList[0] - .entityList[index].procedureName, - categoreId: model - .procedureList[0].entityList[index].categoryID - .toString(), - procedureId: model.procedureList[0] - .entityList[index].procedureId, - limetNo: model.procedureList[0].entityList[index] - .lineItemNo); + remarks: model.procedureList[0].entityList[index].remarks, + orderType: model.procedureList[0].entityList[index].orderType.toString(), + orderNo: model.procedureList[0].entityList[index].orderNo, + procedureName: model.procedureList[0].entityList[index].procedureName, + categoreId: model.procedureList[0].entityList[index].categoryID.toString(), + procedureId: model.procedureList[0].entityList[index].procedureId, + limetNo: model.procedureList[0].entityList[index].lineItemNo); // } else // Helpers.showErrorToast( // 'You Cant Update This Procedure'); @@ -194,8 +177,7 @@ class ProcedureScreen extends StatelessWidget { ), ), if (model.state == ViewState.ErrorLocal || - (model.procedureList.isNotEmpty && - model.procedureList[0].entityList.isEmpty)) + (model.procedureList.isNotEmpty && model.procedureList[0].entityList.isEmpty)) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -206,9 +188,7 @@ class ProcedureScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(22.0), - child: AppText(model.procedureList.isEmpty - ? model.error - : 'No Procedure Found '), + child: AppText(model.procedureList.isEmpty ? model.error : 'No Procedure Found '), ) ], ), diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index db8dd3c2..3cdeb180 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -22,6 +22,7 @@ import 'package:provider/provider.dart'; class AddSickLeavScreen extends StatelessWidget { PatiantInformtion patient; + @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); @@ -31,8 +32,10 @@ class AddSickLeavScreen extends StatelessWidget { bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) async { - await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId); - await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); + await model + .getSickLeavePatient(patient.patientMRN ?? patient.patientId); + await model + .getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -79,17 +82,21 @@ class AddSickLeavScreen extends StatelessWidget { }, child: Container( width: SizeConfig.screenWidth, - margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), + margin: EdgeInsets.only( + left: 20, right: 20, top: 10, bottom: 10), padding: EdgeInsets.all(20), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( child: Container( - decoration: - BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: + BorderRadius.circular(10)), padding: EdgeInsets.all(3), child: IconButton( icon: Icon( @@ -106,7 +113,9 @@ class AddSickLeavScreen extends StatelessWidget { ), )), Padding( - child: AppText(TranslationBase.of(context).noSickLeaveApplied, + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 16, @@ -122,7 +131,8 @@ class AddSickLeavScreen extends StatelessWidget { : SizedBox(), model.getAllSIckLeavePatient.length > 0 ? Column( - children: model.getAllSIckLeavePatient.map((SickLeavePatientModel item) { + children: model.getAllSIckLeavePatient + .map((SickLeavePatientModel item) { return RoundedContainer( margin: EdgeInsets.all(10), child: Column( @@ -141,7 +151,8 @@ class AddSickLeavScreen extends StatelessWidget { // ))), padding: EdgeInsets.all(10), child: Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( flex: 4, @@ -150,7 +161,8 @@ class AddSickLeavScreen extends StatelessWidget { // MainAxisAlignment.start, children: [ Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.all(3), @@ -168,7 +180,8 @@ class AddSickLeavScreen extends StatelessWidget { // : TranslationBase // .of(context) // .all, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, // color: item.status == 1 // ? Colors.yellow[800] // : item.status == 2 @@ -179,25 +192,48 @@ class AddSickLeavScreen extends StatelessWidget { ), Row( children: [ - AppText(TranslationBase.of(context).daysSickleave + ": "), + AppText(TranslationBase + .of(context) + .daysSickleave + + ": "), AppText( - item.sickLeaveDays.toString() ?? item.noOfDays.toString(), - fontWeight: FontWeight.bold, + (item.sickLeaveDays + .toString() != + null && + item.sickLeaveDays + .toString() != + "null") + ? item.sickLeaveDays + .toString() + : item.noOfDays + .toString(), + fontWeight: + FontWeight.bold, ), ], ), Row( children: [ AppText( - TranslationBase.of(context).startDate + ' ' ?? "", + TranslationBase.of( + context) + .startDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.startDate) - : DateTime.parse(item.startDate)), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils + .convertStringToDate(item + .startDate) + : DateTime.parse( + item.startDate)), + fontWeight: + FontWeight.bold, ), ) ], @@ -205,18 +241,30 @@ class AddSickLeavScreen extends StatelessWidget { Row( children: [ AppText( - TranslationBase.of(context).endDate + ' ' ?? "", + TranslationBase.of( + context) + .endDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.endDate ?? "") - .add(Duration( - days: item.noOfDays ?? item.sickLeaveDays)) - : DateTime.parse(item.startDate ?? "") - .add(Duration(days: item.noOfDays ?? ""))), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils.convertStringToDate( + item.endDate ?? + "") + .add(Duration( + days: item.noOfDays ?? + item + .sickLeaveDays)) + : DateTime.parse( + item.startDate ?? "") + .add(Duration(days: item.noOfDays ?? ""))), + fontWeight: + FontWeight.bold, ), ) ], @@ -246,7 +294,8 @@ class AddSickLeavScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noSickLeave), + child: AppText( + TranslationBase.of(context).noSickLeave), ) ], ), @@ -255,7 +304,8 @@ class AddSickLeavScreen extends StatelessWidget { ])))); } - openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { // showModalBottomSheet( // context: context, // builder: (context) { @@ -265,9 +315,13 @@ class AddSickLeavScreen extends StatelessWidget { context, FadePage( page: SickLeaveScreen( - appointmentNo: - isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo, - patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN, + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, + //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, isExtended: isExtend, extendedData: extendedData, patient: patient))); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 118efbfb..0297aa45 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -91,6 +91,7 @@ class TranslationBase { String get inPatient => localizedValues['inPatient'][locale.languageCode]; String get myInPatient => localizedValues['myInPatient'][locale.languageCode]; + String get myInPatientTitle => localizedValues['myInPatientTitle'][locale.languageCode]; String get inPatientLabel => localizedValues['inPatientLabel'][locale.languageCode]; String get inPatientAll => localizedValues['inPatientAll'][locale.languageCode]; @@ -1102,6 +1103,8 @@ class TranslationBase { String get textResponse => localizedValues['textResponse'][locale.languageCode]; String get special => localizedValues['special'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; + String get allClinic => localizedValues['allClinic'][locale.languageCode]; + String get notReplied => localizedValues['notReplied'][locale.languageCode]; } diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b86256fd..ef69903b 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'ShowTimer.dart'; @@ -81,8 +82,7 @@ class PatientCard extends StatelessWidget { ? Row( children: [ AppText( - TranslationBase.of(context) - .arrivedP, + TranslationBase.of(context).arrivedP, color: Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -102,12 +102,8 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Confirmed' - : 'Booked', - color: patientInfo.status == 2 - ? Colors.green - : Colors.grey, + patientInfo.status == 2 ? 'Confirmed' : 'Booked', + color: patientInfo.status == 2 ? Colors.green : Colors.grey, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 10, @@ -118,8 +114,7 @@ class PatientCard extends StatelessWidget { ? Row( children: [ AppText( - TranslationBase.of(context) - .notArrived, + TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -139,27 +134,19 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Confirmed' - : 'Booked', - color: patientInfo.status == 2 - ? Colors.green - : Colors.grey, + patientInfo.status == 2 ? 'Confirmed' : 'Booked', + color: patientInfo.status == 2 ? Colors.green : Colors.grey, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 10, ), ], ) - : !isFromSearch && - !isFromLiveCare && - patientInfo.patientStatusType == - null + : !isFromSearch && !isFromLiveCare && patientInfo.patientStatusType == null ? Row( children: [ AppText( - TranslationBase.of(context) - .notArrived, + TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -179,13 +166,8 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Booked' - : 'Confirmed', - color: - patientInfo.status == 2 - ? Colors.grey - : Colors.green, + patientInfo.status == 2 ? 'Booked' : 'Confirmed', + color: patientInfo.status == 2 ? Colors.grey : Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 12, @@ -195,17 +177,13 @@ class PatientCard extends StatelessWidget { : SizedBox(), this.arrivalType == '1' ? AppText( - patientInfo.startTime != null - ? patientInfo.startTime - : patientInfo.startTimes, + patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes, fontFamily: 'Poppins', fontWeight: FontWeight.w400, ) : patientInfo.arrivedOn != null ? AppText( - AppDateUtils.getDayMonthYearDate( - AppDateUtils - .convertStringToDate( + AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.arrivedOn, )) + " " + @@ -214,10 +192,8 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w400, fontSize: 15, ) - : (patientInfo.appointmentDate != - null && - patientInfo - .appointmentDate.isNotEmpty) + : (patientInfo.appointmentDate != null && + patientInfo.appointmentDate.isNotEmpty) ? AppText( "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.appointmentDate, @@ -256,13 +232,10 @@ class PatientCard extends StatelessWidget { // width: MediaQuery.of(context).size.width*0.51, child: AppText( isFromLiveCare - ? Helpers.capitalize( - patientInfo.fullName) - : (Helpers.capitalize( - patientInfo.firstName) + + ? Helpers.capitalize(patientInfo.fullName) + : (Helpers.capitalize(patientInfo.firstName) + " " + - Helpers.capitalize( - patientInfo.lastName)), + Helpers.capitalize(patientInfo.lastName)), fontSize: 16, color: Color(0xff2e303a), fontWeight: FontWeight.w700, @@ -300,25 +273,19 @@ class PatientCard extends StatelessWidget { fontSize: 14, textOverflow: TextOverflow.ellipsis, ), - patientInfo.nationality != null || - patientInfo.nationalityId != null + patientInfo.nationality != null || patientInfo.nationalityId != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), - child: Image.network( - patientInfo.nationalityFlagURL != null + borderRadius: BorderRadius.circular(20.0), + child: CachedNetworkImage( + imageUrl: patientInfo.nationalityFlagURL != null ? patientInfo.nationalityFlagURL : '', height: 25, width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return AppText( - 'No Image', - fontSize: 10, - ); - }, + errorWidget: (context, url, error) => AppText( + 'No Image', + fontSize: 10, + ), )) : SizedBox() ], @@ -348,58 +315,74 @@ class PatientCard extends StatelessWidget { width: 10, ), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).fileNumber, - value: patientInfo.patientId.toString(), - ), - - //if (isInpatient) - - CustomRow( - label: TranslationBase.of(context).age + " : ", - value: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - ), - - if (isInpatient) - CustomRow( - label: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - value: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: TranslationBase.of(context).numOfDays + - " : ", - value: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: - TranslationBase.of(context).roomNo + " : ", - value: "${patientInfo.roomId}", - ), - - if (isFromLiveCare) - Column( + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomRow( - label: TranslationBase.of(context).clinic + - " : ", - value: patientInfo.clinicName, + label: + TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), ), - ], - ), - ])) + CustomRow( + label: + TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", + ), + if (isInpatient) + CustomRow( + label: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context).admissionDate + " : ", + + value: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context) + .numOfDays + + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: + TranslationBase.of(context).clinicName + + " : ", + value: "${patientInfo.clinicDescription}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: + TranslationBase.of(context).roomNo + + " : ", + value: "${patientInfo.roomId}", + ), + if (isFromLiveCare) + Column( + children: [ + CustomRow( + label: TranslationBase.of(context) + .clinic + + " : ", + value: patientInfo.clinicName, + ), + ], + ), + ]), + ), + Icon( + Icons.arrow_forward, + size: 24, + ), + ], + )) ]), isFromLiveCare ? Row( @@ -416,36 +399,29 @@ class PatientCard extends StatelessWidget { ], ) : !isInpatient && !isFromSearch - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ + ? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + patientInfo.appointmentType == 'Regular' && patientInfo.visitTypeId == 100 + ? 'assets/images/livecare.png' + : patientInfo.appointmentType == 'Walkin' + ? 'assets/images/walkin.png' + : 'assets/images/booked.png', + height: 25, + width: 35, + )), + ]) + : (isInpatient == true) + ? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ Container( padding: EdgeInsets.all(4), child: Image.asset( - patientInfo.appointmentType == - 'Regular' && - patientInfo.visitTypeId == 100 - ? 'assets/images/livecare.png' - : patientInfo.appointmentType == - 'Walkin' - ? 'assets/images/walkin.png' - : 'assets/images/booked.png', + 'assets/images/inpatient.png', height: 25, width: 35, )), ]) - : (isInpatient == true) - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(4), - child: Image.asset( - 'assets/images/inpatient.png', - height: 25, - width: 35, - )), - ]) : SizedBox() ], ), @@ -454,5 +430,3 @@ class PatientCard extends StatelessWidget { )); } } - - diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 53228bc2..0a405d8d 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -1,13 +1,14 @@ import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:cached_network_image/cached_network_image.dart'; class ProfileWelcomeWidget extends StatelessWidget { final Widget clinicWidget; final double height; final bool isClinic; - ProfileWelcomeWidget(this.clinicWidget, - {this.height = 150, this.isClinic = false}); + + ProfileWelcomeWidget(this.clinicWidget, {this.height = 150, this.isClinic = false}); @override Widget build(BuildContext context) { @@ -27,24 +28,23 @@ class ProfileWelcomeWidget extends StatelessWidget { SizedBox( width: 20, ), - if(authenticationViewModel.doctorProfile!=null) - CircleAvatar( - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: Image.network( - authenticationViewModel.doctorProfile.doctorImageURL, - fit: BoxFit.fill, - width: 75, - height: 75, + if (authenticationViewModel.doctorProfile != null) + CircleAvatar( + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + imageUrl: authenticationViewModel.doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 75, + height: 75, + ), ), + backgroundColor: Colors.transparent, ), - backgroundColor: Colors.transparent, - ), SizedBox( height: 20, ), - ], )), ); diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index d414f557..c8e187a1 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -26,7 +25,7 @@ class CardWithBgWidget extends StatelessWidget { Radius.circular(10.0), ), border: Border.all( - color: hasBorder ? HexColor('#707070') : Colors.transparent, + color: hasBorder ? Color(0xFF707070) : Colors.transparent, width: hasBorder ? 0.30 : 0), ), child: Material( @@ -37,8 +36,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), - + color: bgColor ?? Color(0xFF58434F), borderRadius: BorderRadius.only( topRight: Radius.circular(10), bottomRight: Radius.circular(10),),), @@ -52,8 +50,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), - + color: bgColor ?? Color(0xFF58434F), borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10),),), diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 76932ecd..dfaf9143 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -71,43 +71,48 @@ class _ListSelectDialogState extends State { Widget createDialogList() { return Container( height: MediaQuery.of(context).size.height * 0.5, - child: SingleChildScrollView( - child: Column( - children: [ - if (widget.searchWidget != null) widget.searchWidget, - if(widget.usingSearch) - Container( + child: Column( + children: [ + if (widget.searchWidget != null) widget.searchWidget, + if (widget.usingSearch) + Container( height: MediaQuery.of(context).size.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - widget.hintSearchText ?? TranslationBase - .of(context) - .search, null, false, suffixIcon: Icon(Icons.search,)), - enabled: true, - keyboardType: TextInputType.text, - onChanged: (value) { - filterSearchResults(value); - }, - )), - ...items - .map((item) => RadioListTile( - title: Text("${item[widget.attributeName].toString()}"), - groupValue: widget.selectedValue[widget.attributeValueId] - .toString(), - value: item[widget.attributeValueId].toString(), - activeColor: Colors.blue.shade700, - selected: item[widget.attributeValueId].toString() == - widget.selectedValue[widget.attributeValueId] - .toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) - .toList() - ], - ), + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + widget.hintSearchText ?? TranslationBase.of(context).search, null, false, + suffixIcon: Icon( + Icons.search, + )), + enabled: true, + keyboardType: TextInputType.text, + onChanged: (value) { + filterSearchResults(value); + }, + )), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + ...items + .map((item) => RadioListTile( + title: Text("${item[widget.attributeName].toString()}"), + groupValue: widget.selectedValue[widget.attributeValueId].toString(), + value: item[widget.attributeValueId].toString(), + activeColor: Colors.blue.shade700, + selected: item[widget.attributeValueId].toString() == + widget.selectedValue[widget.attributeValueId].toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ), + ], ), ); } diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index faa4379a..5bd12bb8 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -157,6 +157,7 @@ class DoctorCard extends StatelessWidget { ), if (branch != null) Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).branch + @@ -164,9 +165,11 @@ class DoctorCard extends StatelessWidget { fontSize: 14, color: Colors.grey[500], ), - AppText( - branch, - fontSize: 14, + Expanded( + child: AppText( + branch, + fontSize: 14, + ), ) ], ) diff --git a/lib/widgets/shared/user-guid/CusomRow.dart b/lib/widgets/shared/user-guid/CusomRow.dart index 3768d34e..b66d4926 100644 --- a/lib/widgets/shared/user-guid/CusomRow.dart +++ b/lib/widgets/shared/user-guid/CusomRow.dart @@ -7,7 +7,7 @@ class CustomRow extends StatelessWidget { const CustomRow({ Key key, this.label, - this.value, this.labelSize, this.valueSize, this.width, + this.value, this.labelSize, this.valueSize, this.width, this.isCopyable= true, }) : super(key: key); final String label; @@ -15,6 +15,7 @@ class CustomRow extends StatelessWidget { final double labelSize; final double valueSize; final double width; + final bool isCopyable; @override Widget build(BuildContext context) { @@ -35,7 +36,7 @@ class CustomRow extends StatelessWidget { fontSize: valueSize??SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, - isCopyable: true, + isCopyable: isCopyable, ), ], ); diff --git a/pubspec.yaml b/pubspec.yaml index cf5ced70..66f0df91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -96,6 +96,10 @@ dependencies: # Html Editor Enhanced html_editor_enhanced: ^1.3.0 + #Network Image + cached_network_image: ^2.5.0 + + # Badges badges: ^1.1.4