diff --git a/lib/config/config.dart b/lib/config/config.dart index 30d83dc5..407d4ff6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -134,6 +134,7 @@ const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; +const POST_EPISODE_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/PostEpisodeForInpatient'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; @@ -240,6 +241,7 @@ const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctor const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts"; const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL"; const GET_MEDICATION_FOR_IN_PATIENT = "Services/DoctorApplication.svc/REST/Doctor_GetMedicationForInpatient"; +const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient"; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c84986a7..9ef70508 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -699,9 +699,14 @@ const Map> localizedValues = { "textCopiedSuccessfully": {"en": "Text copied successfully", "ar": "تم نسخ النص بنجاح"}, "roomNo": {"en": "Room No", "ar": "رقم الغرفة"}, "replayCallStatus": {"en": "Called", "ar": "تم الاتصال"}, - "patientArrived": {"en": "Patient Arrived", "ar": "تم الاتصال"}, - "calledAndNoResponse": {"en": "Called And No Response", "ar": "تم الاتصال"}, - "underProcess": {"en": "Under Process", "ar": "تم الاتصال"}, - "textResponse": {"en": "Text Response", "ar": "تم الاتصال"}, + "patientArrived": {"en": "Patient Arrived", "ar": "وصل المريض"}, + "calledAndNoResponse": {"en": "Called And No Response", "ar": "تم الاتصال ولا يوجد رد"}, + "underProcess": {"en": "Under Process", "ar": "تحت التجهيز"}, + "textResponse": {"en": "Text Response", "ar": "استجابة النص" + } + , + "requestType":{ + "en":"Request Type", + "ar":"نوع الطلب"}, "special": {"en": "Special", "ar": "خاص"} }; diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index 09ee7c49..ade01d9b 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -14,7 +14,11 @@ class BaseService { List patientArrivalList = []; -//TODO add the user login model when we need it + BaseService(){ + doctorProfile = null; + } + + //TODO add the user login model when we need it Future getDoctorProfile({bool isGetProfile = false}) async { if(isGetProfile) { diff --git a/lib/core/service/patient/patientInPatientService.dart b/lib/core/service/patient/patientInPatientService.dart index e0bc94a3..bc7f1283 100644 --- a/lib/core/service/patient/patientInPatientService.dart +++ b/lib/core/service/patient/patientInPatientService.dart @@ -10,7 +10,7 @@ class PatientInPatientService extends BaseService { Future getInPatientList( PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; - await getDoctorProfile(); + await getDoctorProfile(isGetProfile: true); if (isMyInpatient) { requestModel.doctorID = doctorProfile.doctorID; 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 b2e0d603..57a54ed0 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -14,6 +14,8 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.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_assessment_request_model.dart'; @@ -63,6 +65,18 @@ class SOAPService extends LookupService { }, body: postEpisodeReqModel.toJson()); } + Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async { + hasError = false; + + await baseAppClient.post(POST_EPISODE_FOR_IN_PATIENT, + onSuccess: (dynamic response, int statusCode) { + episodeID = response['EpisodeID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeForInpatientRequestModel.toJson()); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { hasError = false; @@ -302,4 +316,19 @@ class SOAPService extends LookupService { super.error = error; }, body: getAssessmentReqModel.toJson()); } + + Future getEpisodeForInpatient( + GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel) async { + hasError = false; + await baseAppClient.post(GET_EPISODE_FOR_INPATIENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + + episodeID = response["GetEpisodeNo"]; + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getEpisodeForInpatientReqModel.toJson()); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index d42098a2..78c309ca 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -19,6 +19,8 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.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_assessment_request_model.dart'; @@ -89,56 +91,64 @@ class SOAPViewModel extends BaseViewModel { List get patientAssessmentList => _SOAPService.patientAssessmentList; + int get episodeID => _SOAPService.episodeID; bool isAddProgress = true; bool isAddExamInProgress = true; - String progressNoteText =""; + String progressNoteText = ""; String complaintsControllerError = ''; String medicationControllerError = ''; String illnessControllerError = ''; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; + get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; + get medicationRouteList => _SOAPService.medicationRouteListWithModel; + get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel; + List get allMedicationList => _prescriptionService.allMedicationList; SubjectiveCallBack subjectiveCallBack; - setSubjectiveCallBack(SubjectiveCallBack callBack) - { + + setSubjectiveCallBack(SubjectiveCallBack callBack) { this.subjectiveCallBack = callBack; } - nextOnSubjectPage(model){ + + nextOnSubjectPage(model) { subjectiveCallBack.nextFunction(model); - } + } ObjectiveCallBack objectiveCallBack; - setObjectiveCallBack(ObjectiveCallBack callBack) - { + + setObjectiveCallBack(ObjectiveCallBack callBack) { this.objectiveCallBack = callBack; } - nextOnObjectivePage(model){ + + nextOnObjectivePage(model) { objectiveCallBack.nextFunction(model); } - AssessmentCallBack assessmentCallBack; - setAssessmentCallBack(AssessmentCallBack callBack) - { + + setAssessmentCallBack(AssessmentCallBack callBack) { this.assessmentCallBack = callBack; } - nextOnAssessmentPage(model){ + + nextOnAssessmentPage(model) { assessmentCallBack.nextFunction(model); } PlanCallBack planCallBack; - setPlanCallBack(PlanCallBack callBack) - { + + setPlanCallBack(PlanCallBack callBack) { this.planCallBack = callBack; } - nextOnPlanPage(model){ + + nextOnPlanPage(model) { planCallBack.nextFunction(model); } @@ -176,6 +186,19 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postEpisodeForInPatient( + PostEpisodeForInpatientRequestModel + postEpisodeForInpatientRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postEpisodeForInPatient( + postEpisodeForInpatientRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postAllergy(postAllergyRequestModel); @@ -361,19 +384,22 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientPhysicalExam(PatiantInformtion patientInfo, - ) async { - - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( + Future getPatientPhysicalExam( + PatiantInformtion patientInfo, + ) async { + GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo == null?"0":patientInfo.episodeNo.toString(), - appointmentNo: patientInfo.appointmentNo == null ?0:int.parse( - patientInfo.appointmentNo.toString(), - ), + episodeID: patientInfo.episodeNo == null + ? "0" + : patientInfo.episodeNo.toString(), + appointmentNo: patientInfo.appointmentNo == null + ? 0 + : int.parse( + patientInfo.appointmentNo.toString(), + ), ); - if(patientInfo.admissionNo !=null &&patientInfo.admissionNo.isNotEmpty) - getPhysicalExamReqModel.admissionNo =int.parse(patientInfo.admissionNo); + if (patientInfo.admissionNo != null && patientInfo.admissionNo.isNotEmpty) + getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo); else getPhysicalExamReqModel.admissionNo = 0; setState(ViewState.Busy); @@ -417,6 +443,23 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getEpisodeForInpatient(PatiantInformtion patient) async { + setState(ViewState.BusyLocal); + GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = + GetEpisodeForInpatientReqModel( + patientID: patient.patientId, + admissionNo: int.parse(patient.admissionNo), + patientTypeID: 1); + await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else { + patient.episodeNo = _SOAPService.episodeID; + setState(ViewState.Idle); + } + } + // ignore: missing_return MasterKeyModel getOneMasterKey( {@required MasterKeysService masterKeys, dynamic id, int typeId}) { @@ -530,14 +573,268 @@ class SOAPViewModel extends BaseViewModel { } } - int getFirstIndexForOldExamination(List mySelectedExamination){ - Iterable examList = mySelectedExamination.where( - (element) => !element.isLocal); + int getFirstIndexForOldExamination( + List mySelectedExamination) { + Iterable examList = + mySelectedExamination.where((element) => !element.isLocal); if (examList.length > 0) { return mySelectedExamination.indexOf(examList.first); } else return -1; + } + + onUpdateSubjectStepStart(PatiantInformtion patientInfo) async { + GetChiefComplaintReqModel getChiefComplaintReqModel = + GetChiefComplaintReqModel( + admissionNo: + patientInfo + .admissionNo != + null + ? int.parse(patientInfo.admissionNo) + : null, + patientMRN: patientInfo.patientMRN, + appointmentNo: patientInfo.appointmentNo != null + ? int.parse(patientInfo.appointmentNo.toString()) + : null, + episodeId: patientInfo.episodeNo, + episodeID: patientInfo.episodeNo, + doctorID: ''); + var services = [ + _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel) + ]; + + if (patientInfo.admissionNo == null) { + complaintsControllerError = ''; + medicationControllerError = ''; + illnessControllerError = ''; + GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo.toString(), + appointmentNo: int.parse(patientInfo.appointmentNo.toString()), + doctorID: '', + editedBy: ''); + services.add( + _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true)); + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: int.parse(patientInfo.appointmentNo.toString()), + doctorID: '', + editedBy: ''); + + services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP)); + } + + final results = await Future.wait(services); + await callServicesAfterGetPatientInfoForUpdateSubject(); + } + + callServicesAfterGetPatientInfoForUpdateSubject() async { + var services; + if (patientHistoryList.isNotEmpty) { + if (historyFamilyList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)); + } + } + if (historyMedicalList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)); + } + if (historySurgicalList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)); + } + if (historySportList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.HistorySports) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.HistorySports)); + } + } + + if (patientAllergiesList.isNotEmpty) { + if (allergiesList.isEmpty) if (services == null) { + services = [_SOAPService.getMasterLookup(MasterKeysService.Allergies)]; + } else + services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies)); + if (allergySeverityList.isEmpty) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity) + ]; + } else + services.add( + _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)); + } + } + + final results = await Future.wait(services ?? []); + + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + onAddMedicationStart() async { + setState(ViewState.Busy); + var services; + if (medicationStrengthList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)); + } + } + if (medicationFrequencyList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency) + ]; + } else { + services.add(_SOAPService.getMasterLookup( + MasterKeysService.MedicationFrequency)); + } + } + if (medicationDoseTimeList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)); + } + } + if (medicationRouteList.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)); + } + } + if (allMedicationList.length == 0) { + await getMedicationList(); + if (services == null) { + services = [ + _prescriptionService.getMedicationList() + ]; + } else { + services.add( + _prescriptionService.getMedicationList()); + } + } + + final results = await Future.wait(services ?? []); + + if (_SOAPService.hasError ||_prescriptionService.hasError ) { + error = _SOAPService.error + _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + callAddAssessmentLookupsServices({bool allowSetState = true}) async { + if(allowSetState) + setState(ViewState.Busy); + var services; + if (listOfDiagnosisCondition.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)); + } + } + if (listOfDiagnosisType.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType) + ]; + } else { + services.add(_SOAPService.getMasterLookup( + MasterKeysService.DiagnosisType)); + } + } + if (listOfICD10.length == 0) { + if (services == null) { + services = [ + _SOAPService.getMasterLookup(MasterKeysService.ICD10) + ]; + } else { + services.add( + _SOAPService.getMasterLookup(MasterKeysService.ICD10)); + } + } + + final results = await Future.wait(services ?? []); + 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())); + + 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); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 794706a6..03f6e84a 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -1,3 +1,5 @@ +import 'dart:isolate'; + import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -47,6 +49,21 @@ class BaseViewModel extends ChangeNotifier { } } + void getIsolateDoctorProfile(bool isGetProfile) async { + if (isGetProfile) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + } + } + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + } + } + } + setDoctorProfile(DoctorProfileModel doctorProfile) async { await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile); this.doctorProfile = doctorProfile; diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 02e540af..afcec235 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -1,5 +1,3 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/doctor_reply_service.dart'; @@ -8,16 +6,17 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import '../../locator.dart'; import 'authentication_view_model.dart'; import 'base_view_model.dart'; + class DashboardViewModel extends BaseViewModel { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); DashboardService _dashboardService = locator(); - SpecialClinicsService _specialClinicsService = locator(); + SpecialClinicsService _specialClinicsService = + locator(); DoctorReplyService _doctorReplyService = locator(); List get dashboardItemsList => @@ -26,17 +25,34 @@ class DashboardViewModel extends BaseViewModel { bool get hasVirtualClinic => _dashboardService.hasVirtualClinic; String get sServiceID => _dashboardService.sServiceID; - int get notRepliedCount => _doctorReplyService.notRepliedCount; - List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; + int get notRepliedCount => _doctorReplyService.notRepliedCount; + List get specialClinicalCareList => + _specialClinicsService.specialClinicalCareList; - Future setFirebaseNotification(ProjectViewModel projectsProvider, + Future startHomeScreenServices(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); - await projectsProvider.getDoctorClinicsList(); + await getDoctorProfile(isGetProfile: true); + + final results = await Future.wait([ + projectsProvider.getDoctorClinicsList(), + _dashboardService.getDashboard(), + _dashboardService.checkDoctorHasLiveCare(), + _specialClinicsService.getSpecialClinicalCareList(), + ]); - // _firebaseMessaging.setAutoInitEnabled(true); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + + setFirebaseNotification(authProvider); + } + + Future setFirebaseNotification(AuthenticationViewModel authProvider) async { _firebaseMessaging.requestNotificationPermissions( const IosNotificationSettings( sound: true, badge: true, alert: true, provisional: true)); @@ -105,20 +121,17 @@ class DashboardViewModel extends BaseViewModel { return value.toString(); } - - GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ - GetSpecialClinicalCareListResponseModel special ; + GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId) { + GetSpecialClinicalCareListResponseModel special; specialClinicalCareList.forEach((element) { - if(element.clinicID == clinicId){ + if (element.clinicID == clinicId) { special = element; } }); return special; - } - Future getNotRepliedCount() async { setState(ViewState.BusyLocal); await getDoctorProfile(); diff --git a/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart b/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart new file mode 100644 index 00000000..2b49066e --- /dev/null +++ b/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart @@ -0,0 +1,22 @@ +class GetEpisodeForInpatientReqModel { + int patientID; + int patientTypeID; + int admissionNo; + + GetEpisodeForInpatientReqModel( + {this.patientID, this.patientTypeID, this.admissionNo}); + + GetEpisodeForInpatientReqModel.fromJson(Map json) { + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + admissionNo = json['AdmissionNo']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['AdmissionNo'] = this.admissionNo; + return data; + } +} diff --git a/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart b/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart new file mode 100644 index 00000000..2dff7a60 --- /dev/null +++ b/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart @@ -0,0 +1,22 @@ +class PostEpisodeForInpatientRequestModel { + int admissionNo; + int patientID; + int patientTypeID; + + PostEpisodeForInpatientRequestModel( + {this.admissionNo, this.patientID, this.patientTypeID = 1}); + + PostEpisodeForInpatientRequestModel.fromJson(Map json) { + admissionNo = json['AdmissionNo']; + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['AdmissionNo'] = this.admissionNo; + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/models/doctor/list_gt_my_patients_question_model.dart b/lib/models/doctor/list_gt_my_patients_question_model.dart index a3b2ac98..656a43dd 100644 --- a/lib/models/doctor/list_gt_my_patients_question_model.dart +++ b/lib/models/doctor/list_gt_my_patients_question_model.dart @@ -1,7 +1,5 @@ -import 'package:doctor_app_flutter/util/date-utils.dart'; - - class ListGtMyPatientsQuestions { + Null rowID; String setupID; int projectID; int transactionNo; @@ -9,7 +7,7 @@ class ListGtMyPatientsQuestions { int patientID; int doctorID; int requestType; - DateTime requestDate; + String requestDate; String requestTime; String remarks; int status; @@ -26,12 +24,18 @@ class ListGtMyPatientsQuestions { int infoStatus; String infoDesc; String doctorResponse; + dynamic responseDate; + int memberID; + String memberName; + String memberNameN; String age; String genderDescription; bool isVidaCall; + String requestTypeDescription; ListGtMyPatientsQuestions( - {this.setupID, + {this.rowID, + this.setupID, this.projectID, this.transactionNo, this.patientType, @@ -55,11 +59,17 @@ class ListGtMyPatientsQuestions { this.infoStatus, this.infoDesc, this.doctorResponse, + this.responseDate, + this.memberID, + this.memberName, + this.memberNameN, this.age, this.genderDescription, - this.isVidaCall}); + this.isVidaCall, + this.requestTypeDescription}); ListGtMyPatientsQuestions.fromJson(Map json) { + rowID = json['RowID']; setupID = json['SetupID']; projectID = json['ProjectID']; transactionNo = json['TransactionNo']; @@ -67,7 +77,7 @@ class ListGtMyPatientsQuestions { patientID = json['PatientID']; doctorID = json['DoctorID']; requestType = json['RequestType']; - requestDate = AppDateUtils.convertStringToDate(json['RequestDate']) ; + requestDate = json['RequestDate']; requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; @@ -84,13 +94,19 @@ class ListGtMyPatientsQuestions { infoStatus = json['InfoStatus']; infoDesc = json['InfoDesc']; doctorResponse = json['DoctorResponse']; + responseDate = json['ResponseDate']; + memberID = json['MemberID']; + memberName = json['MemberName']; + memberNameN = json['MemberNameN']; age = json['Age']; genderDescription = json['GenderDescription']; isVidaCall = json['IsVidaCall']; + requestTypeDescription = json['RequestTypeDescription']; } Map toJson() { final Map data = new Map(); + data['RowID'] = this.rowID; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; data['TransactionNo'] = this.transactionNo; @@ -115,11 +131,14 @@ class ListGtMyPatientsQuestions { data['InfoStatus'] = this.infoStatus; data['InfoDesc'] = this.infoDesc; data['DoctorResponse'] = this.doctorResponse; + data['ResponseDate'] = this.responseDate; + data['MemberID'] = this.memberID; + data['MemberName'] = this.memberName; + data['MemberNameN'] = this.memberNameN; data['Age'] = this.age; data['GenderDescription'] = this.genderDescription; data['IsVidaCall'] = this.isVidaCall; + data['RequestTypeDescription'] = this.requestTypeDescription; return data; } } - - diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index 24487964..72f13d4e 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -295,14 +295,14 @@ class _DoctorReplayChatState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.responseDate !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.responseDate)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Color(0xFF2B353E), fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8, ), AppText( - widget.reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getHour(DateTime.now()), + widget.reply.responseDate !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(widget.reply.responseDate)):AppDateUtils.getHour(DateTime.now()), fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8, fontFamily: 'Poppins', color: Color(0xFF2B353E), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 64d72067..32a842d3 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -66,12 +66,7 @@ class _HomeScreenState extends State { return BaseView( onModelReady: (model) async { - await model.setFirebaseNotification( - projectsProvider, authenticationViewModel); - await model.getDashboard(); - await model.getDoctorProfile(isGetProfile: true); - await model.checkDoctorHasLiveCare(); - await model.getSpecialClinicalCareList(); + model.startHomeScreenServices(projectsProvider, authenticationViewModel); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 0c0d548d..8314a653 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -127,6 +127,9 @@ class _InPatientPageState extends State { "isSearch": false, "isInpatient": true, "arrivalType": "1", + "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID, }); }, ); diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 90a9ba29..f094f71a 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -69,9 +69,10 @@ class _PatientInPatientScreenState extends State await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); requestModel.nursingStationID = model.specialClinicalCareMappingList[0].nursingStationID; - requestModel.clinicID = 0; + } - model.getInPatientList(requestModel); + requestModel.clinicID = 0; + await model.getInPatientList(requestModel); }, builder: (_, model, w) => AppScaffold( diff --git a/lib/screens/patients/profile/lab_result/FlowChartPage.dart b/lib/screens/patients/profile/lab_result/FlowChartPage.dart index fcc9746a..be863b87 100644 --- a/lib/screens/patients/profile/lab_result/FlowChartPage.dart +++ b/lib/screens/patients/profile/lab_result/FlowChartPage.dart @@ -10,6 +10,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'lab_result_history_chart_and_detials.dart'; import 'lab_result_chart_and_detials.dart'; class FlowChartPage extends StatelessWidget { @@ -18,48 +19,57 @@ class FlowChartPage extends StatelessWidget { final PatiantInformtion patient; final bool isInpatient; - FlowChartPage({this.patientLabOrder, this.filterName, this.patient, this.isInpatient}); + FlowChartPage( + {this.patientLabOrder, this.filterName, this.patient, this.isInpatient}); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getPatientLabOrdersResults( + onModelReady: (model) => model.getPatientLabResultHistoryByDescription( patientLabOrder: patientLabOrder, - procedure: filterName, + procedureDescription: filterName, patient: patient), + // onModelReady: (model) => model.getPatientLabOrdersResults( + // patientLabOrder: patientLabOrder, + // procedure: filterName, + // patient: patient), builder: (context, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: filterName, baseViewModel: model, - body: model.labOrdersResultsList.isNotEmpty + body: model.labOrdersResultHistoryList.isNotEmpty ? SingleChildScrollView( child: Container( - child: LabResultChartAndDetails( + child: LabResultHistoryChartAndDetails( name: filterName, - labResult: model.labOrdersResultsList, + labResultHistory: model.labOrdersResultHistoryList, ), + // child: LabResultChartAndDetails( + // name: filterName, + // labResult: model.labOrdersResultsList, + // ), ), ) : Container( - child: Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).noDataAvailable, - fontWeight: FontWeight.normal, - color: HexColor("#B8382B"), - fontSize: SizeConfig.textMultiplier * 2.5, - ), - ) - ], + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).noDataAvailable, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ) + ], + ), ), ), - ), ), ); } diff --git a/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart b/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart index 1142a4ec..118bc476 100644 --- a/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart +++ b/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart @@ -15,7 +15,7 @@ class LabResultHistoryPage extends StatelessWidget { final PatiantInformtion patient; LabResultHistoryPage({this.patientLabOrder, this.filterName, this.patient}); - +// TODO mosa UI changes @override Widget build(BuildContext context) { return BaseView( @@ -34,6 +34,7 @@ class LabResultHistoryPage extends StatelessWidget { ...List.generate(model.labOrdersResultHistoryList.length, (index) { return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), child: Column( children: [ Row( @@ -116,6 +117,14 @@ class LabResultHistoryPage extends StatelessWidget { ), ], ), + Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + SizedBox( + height: 10, + ), ], ), ); diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index 47c9925b..ecbaa919 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -47,26 +47,26 @@ class LabResultWidget extends StatelessWidget { AppText(filterName), ], ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: filterName, - patientLabOrder: patientLabOrder, - patient: patient, - isInpatient: isInpatient, - ), - ), - ); - }, - child: AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, - ), - ), + // InkWell( + // onTap: () { + // Navigator.push( + // context, + // FadePage( + // page: FlowChartPage( + // filterName: filterName, + // patientLabOrder: patientLabOrder, + // patient: patient, + // isInpatient: isInpatient, + // ), + // ), + // ); + // }, + // // child: AppText( + // // TranslationBase.of(context).showMoreBtn, + // // textDecoration: TextDecoration.underline, + // // color: Colors.blue, + // // ), + // ), ], ), Row( @@ -119,25 +119,43 @@ class LabResultWidget extends StatelessWidget { ...List.generate( patientLabResultList.length, (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: (){ + onTap: () { Navigator.push( context, FadePage( - page: LabResultHistoryPage( - filterName: patientLabResultList[index].description, + 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: 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( diff --git a/lib/screens/patients/profile/lab_result/Lab_Result_history_details_wideget.dart b/lib/screens/patients/profile/lab_result/Lab_Result_history_details_wideget.dart new file mode 100644 index 00000000..490d0ec4 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/Lab_Result_history_details_wideget.dart @@ -0,0 +1,116 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class LabResultHistoryDetailsWidget extends StatefulWidget { + final List labResultHistory; + + LabResultHistoryDetailsWidget({ + this.labResultHistory, + }); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + /* decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), + border: Border.all(color: Colors.grey, width: 1), + ),*/ + margin: EdgeInsets.all(0), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Container( + padding: EdgeInsets.all(8), + child: AppText( + TranslationBase.of(context).date, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(8), + child: Container( + child: AppText( + TranslationBase.of(context).labResult, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.bold, + ), + // height: 60 + ), + ), + ) + ], + ), + const Divider( + height: 1, + thickness: 1, + color: Colors.black, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 1.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + widget.labResultHistory.forEach((vital) { + var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime); + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(8), + color: Colors.white, + child: AppText( + '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w600, + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(8), + color: Colors.white, + child: AppText( + '${vital.resultValue}', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w600, + ), + ), + ), + ])); + }); + return tableRow; + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart b/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart new file mode 100644 index 00000000..ea9300d0 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart @@ -0,0 +1,231 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartCurvedLabHistory extends StatefulWidget { + final String title; + final List labResultHistory; + + LineChartCurvedLabHistory({this.title, this.labResultHistory}); + + @override + State createState() => LineChartCurvedLabHistoryState(); +} + +class LineChartCurvedLabHistoryState extends State { + bool isShowingMainData; + List xAxixs = List(); + int indexes = 0; + + @override + void initState() { + super.initState(); + getXaxix(); + isShowingMainData = true; + } + + getXaxix() { + indexes = widget.labResultHistory.length ~/ 3.5; + for (int index = 0; index < widget.labResultHistory.length; index++) { + int mIndex = indexes * index; + if (mIndex < widget.labResultHistory.length) { + xAxixs.add(mIndex); + } + } + } + + @override + Widget build(BuildContext context) { + return AspectRatio( + aspectRatio: 1.23, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + AppText( + widget.title, + fontSize: SizeConfig.textMultiplier * 2.1, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + textAlign: TextAlign.center, + ), + const SizedBox( + height: 12, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 16.0, left: 8.0), + child: LineChart( + sampleData1(), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + LineChartData sampleData1() { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 11, + ), + margin: 28, + rotateAngle: -65, + getTitles: (value) { + print(value); + DateTime date = AppDateUtils.convertStringToDate( + widget.labResultHistory[value.toInt()].verifiedOnDateTime); + if (widget.labResultHistory.length < 8) { + if (widget.labResultHistory.length > value.toInt()) { + return '${date.day}/ ${date.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) return '${date.day}/ ${date.year}'; + if (value.toInt() == widget.labResultHistory.length - 1) + return '${date.day}/ ${date.year}'; + if (xAxixs.contains(value.toInt())) { + return '${date.day}/ ${date.year}'; + } + } + + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + return '${value.toInt()}'; + }, + margin: 8, + //reservedSize: 30, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (widget.labResultHistory.length - 1).toDouble(), + maxY: getMaxY() + 2, + minY: getMinY(), + lineBarsData: getData(), + ); + } + + double getMaxY() { + double max = 0; + widget.labResultHistory.forEach((element) { + try { + double resultValueDouble = double.parse(element.resultValue); + if (resultValueDouble > max) max = resultValueDouble; + } catch (e) { + print(e); + } + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = 0; + try { + min = double.parse(widget.labResultHistory[0].resultValue); + + widget.labResultHistory.forEach((element) { + double resultValueDouble = double.parse(element.resultValue); + if (resultValueDouble < min) min = resultValueDouble; + }); + } catch (e) { + print(e); + } + int value = min.toInt(); + + return value.toDouble(); + } + + List getData() { + List spots = List(); + for (int index = 0; index < widget.labResultHistory.length; index++) { + try { + var resultValueDouble = + double.parse(widget.labResultHistory[index].resultValue); + spots.add(FlSpot(index.toDouble(), resultValueDouble)); + } catch (e) { + print(e); + spots.add(FlSpot(index.toDouble(), 0.0)); + } + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Colors.red], + barWidth: 3, + isStrokeCapRound: true, + curveSmoothness: 0.12, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart b/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart index 6026c9e9..49fee0f4 100644 --- a/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart +++ b/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart @@ -5,8 +5,8 @@ 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'; -import 'Lab_Result_details_wideget.dart'; import 'LineChartCurved.dart'; +import 'Lab_Result_details_wideget.dart'; class LabResultChartAndDetails extends StatelessWidget { diff --git a/lib/screens/patients/profile/lab_result/lab_result_history_chart_and_detials.dart b/lib/screens/patients/profile/lab_result/lab_result_history_chart_and_detials.dart new file mode 100644 index 00000000..322eb817 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/lab_result_history_chart_and_detials.dart @@ -0,0 +1,62 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.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'; + +import 'Lab_Result_history_details_wideget.dart'; +import 'LineChartCurvedLabHistory.dart'; + +class LabResultHistoryChartAndDetails extends StatelessWidget { + LabResultHistoryChartAndDetails({ + Key key, + @required this.labResultHistory, + @required this.name, + }) : super(key: key); + + final List labResultHistory; + final String name; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(12)), + child: LineChartCurvedLabHistory( + title: name, + labResultHistory: labResultHistory, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16), + padding: EdgeInsets.only(top: 16, right: 18.0, left: 16.0), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).graphDetails, + fontSize: SizeConfig.textMultiplier * 2.1, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 8, + ), + LabResultHistoryDetailsWidget( + labResultHistory: labResultHistory.reversed.toList(), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index e58d4ef5..4ccd4379 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -49,20 +49,16 @@ class _LaboratoryResultPageState extends State { body: AppScaffold( isShowAppBar: false, body: SingleChildScrollView( - child: Column( - children: [ - LaboratoryResultWidget( - onTap: () async {}, - billNo: widget.patientLabOrders.invoiceNo, - details: model.patientLabSpecialResult.length > 0 - ? model.patientLabSpecialResult[0].resultDataHTML - : null, - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, - patient: widget.patient, - isInpatient: widget.patientType == "1", - ), - ], + child: LaboratoryResultWidget( + onTap: () async {}, + billNo: widget.patientLabOrders.invoiceNo, + details: model.patientLabSpecialResult.length > 0 + ? model.patientLabSpecialResult[0].resultDataHTML + : null, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, + patient: widget.patient, + isInpatient: widget.patientType == "1", ), ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 5130f7ab..ff6752ff 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/lab_result/LabResult import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -88,16 +89,20 @@ class _LaboratoryResultWidgetState extends State { children: [ Expanded( child: Container( - margin: EdgeInsets.only(left: 10, right: 10), + margin: EdgeInsets.only( + left: 10, right: 10), child: AppText( - TranslationBase.of(context).generalResult, + TranslationBase.of(context) + .generalResult, bold: true, ))), Container( width: 25, height: 25, child: Icon( - _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + _isShowMoreGeneral + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, color: Colors.grey[800], size: 22, ), @@ -128,8 +133,11 @@ class _LaboratoryResultWidgetState extends State { model.labResultLists.length, (index) => LabResultWidget( patientLabOrder: widget.patientLabOrder, - filterName: model.labResultLists[index].filterName, - patientLabResultList: model.labResultLists[index].patientLabResultList, + filterName: model + .labResultLists[index].filterName, + patientLabResultList: model + .labResultLists[index] + .patientLabResultList, patient: widget.patient, isInpatient: widget.isInpatient, ), @@ -140,6 +148,12 @@ class _LaboratoryResultWidgetState extends State { ), ], ), + ) + else + Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable, + ), ), SizedBox( height: 15, @@ -166,16 +180,20 @@ class _LaboratoryResultWidgetState extends State { children: [ Expanded( child: Container( - margin: EdgeInsets.only(left: 10, right: 10), + margin: EdgeInsets.only( + left: 10, right: 10), child: AppText( - TranslationBase.of(context).specialResult, + TranslationBase.of(context) + .specialResult, bold: true, ))), Container( width: 25, height: 25, child: Icon( - _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + _isShowMore + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, color: Colors.grey[800], size: 22, ), @@ -200,10 +218,14 @@ class _LaboratoryResultWidgetState extends State { width: double.infinity, child: !Helpers.isTextHtml(widget.details) ? AppText( - widget.details ?? TranslationBase.of(context).noDataAvailable, + widget.details ?? + TranslationBase.of(context) + .noDataAvailable, ) : Html( - data: widget.details ?? TranslationBase.of(context).noDataAvailable, + data: widget.details ?? + TranslationBase.of(context) + .noDataAvailable, ), ), ), diff --git a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart index 8984fa04..ab24f8e0 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart @@ -75,8 +75,6 @@ class MedicalReportDetailPage extends StatelessWidget { ), ), child: Html( - - data: medicalReport.reportDataHtml ?? "" ), ) : Container( 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 eec42b86..5df41821 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.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/live_care/end_call_screen.dart'; @@ -31,7 +32,8 @@ class PatientProfileScreen extends StatefulWidget { _PatientProfileScreenState createState() => _PatientProfileScreenState(); } -class _PatientProfileScreenState extends State with SingleTickerProviderStateMixin { +class _PatientProfileScreenState extends State + with SingleTickerProviderStateMixin { PatiantInformtion patient; LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); @@ -54,6 +56,7 @@ class _PatientProfileScreenState extends State with Single StreamController videoCallDurationStreamController; Stream videoCallDurationStream = (() async* {})(); + @override void initState() { _tabController = TabController(length: 2, vsync: this); @@ -108,15 +111,17 @@ class _PatientProfileScreenState extends State with Single } StreamSubscription callTimer; + callConnected() { - callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) - ..onDone(() { - callTimer.cancel(); - }) - ..onData((data) { - var t = Helpers.timeFrom(duration: data.elapsed); - videoCallDurationStreamController.sink.add(t); - }); + callTimer = + CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) + ..onDone(() { + callTimer.cancel(); + }) + ..onData((data) { + var t = Helpers.timeFrom(duration: data.elapsed); + videoCallDurationStreamController.sink.add(t); + }); } callDisconnected() { @@ -133,12 +138,12 @@ class _PatientProfileScreenState extends State with Single final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async { - if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId); + if (isFromLiveCare && patient.patientStatus == 1) + await model.addPatientToDoctorList(patient.vcId); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - + isLoading: true, appBarTitle: TranslationBase.of(context).patientProfile, isShowAppBar: false, body: Column( @@ -147,11 +152,13 @@ class _PatientProfileScreenState extends State with Single children: [ Column( children: [ - PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType, + PatientProfileHeaderNewDesignAppBar( + patient, arrivalType ?? '0', patientType, videoCallDurationStream: videoCallDurationStream, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - height: (patient.patientStatusType != null && patient.patientStatusType == 43) + height: (patient.patientStatusType != null && + patient.patientStatusType == 43) ? 210 : isDischargedPatient ? 240 @@ -183,7 +190,8 @@ class _PatientProfileScreenState extends State with Single isInpatient: isInpatient, from: from, to: to, - isDischargedPatient: isDischargedPatient, + isDischargedPatient: + isDischargedPatient, isFromSearch: isFromSearch, ) : ProfileGridForOther( @@ -204,25 +212,34 @@ class _PatientProfileScreenState extends State with Single ), ], ), - if ( (isInpatient && isMyPatient )? true:isFromLiveCare - ? patient.episodeNo != null - : patient.patientStatusType != null && patient.patientStatusType == 43) + if ((isInpatient) + ? true + : isFromLiveCare + ? patient.episodeNo != null + : patient.patientStatusType != null && + patient.patientStatusType == 43) BaseView( onModelReady: (model) async { model.getDoctorProfile(); + if (isInpatient) { + await model.getEpisodeForInpatient(patient); + } }, builder: (_, model, w) => Positioned( top: 180, left: 20, right: 20, - child: Row( + child: Row( children: [ Expanded(child: Container()), if (patient.episodeNo == 0) AppButton( + loading: model.state== ViewState.BusyLocal, + disabled: model.state== ViewState.BusyLocal, + title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", - color: isFromLiveCare + color: isFromLiveCare || isInpatient ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 @@ -239,29 +256,22 @@ class _PatientProfileScreenState extends State with Single height: 30, ), onPressed: () async { - if ((isFromLiveCare && patient.appointmentNo != null) || - patient.patientStatusType == 43) { - await locator().logEvent( - eventCategory: "Patient Profile", - eventAction: "Create Episode", - ); - PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( - appointmentNo: int.parse(patient.appointmentNo.toString()), - patientMRN: patient.patientMRN); - GifLoaderDialogUtils.showMyDialog(context); - await model.postEpisode(postEpisodeReqModel); - GifLoaderDialogUtils.hideDialog(context); - patient.episodeNo = model.episodeID; - Navigator.of(context) - .pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); + if ((isFromLiveCare && + patient.appointmentNo != null) || + patient.patientStatusType == 43 || isInpatient ) { + createEpisode( + patient: patient, model: model); } }, ), if (patient.episodeNo != 0) AppButton( + loading: model.state== ViewState.BusyLocal, + disabled: model.state== ViewState.BusyLocal, + title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: (isInpatient &&isMyPatient ) || isFromLiveCare + color: ((isInpatient) || isFromLiveCare) && model.state!= ViewState.BusyLocal ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 @@ -278,16 +288,19 @@ class _PatientProfileScreenState extends State with Single height: 30, ), onPressed: () async { - await locator().logEvent( + await locator() + .logEvent( eventCategory: "Patient Profile ", eventAction: "Update Episode", ); if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || - patient.patientStatusType == 43 ||isInpatient ) { - Navigator.of(context) - .pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); + patient.patientStatusType == 43 || + isInpatient) { + Navigator.of(context).pushNamed( + UPDATE_EPISODE, + arguments: {'patient': patient}); } }), ], @@ -319,11 +332,14 @@ class _PatientProfileScreenState extends State with Single child: Center( child: AppButton( fontWeight: FontWeight.w700, - color: isCallFinished ? Colors.red[600] : Colors.green[600], + color: isCallFinished + ? Colors.red[600] + : Colors.green[600], title: isCallFinished ? TranslationBase.of(context).endCall : TranslationBase.of(context).initiateCall, - disabled: isCallStarted || model.state == ViewState.BusyLocal, + disabled: isCallStarted || + model.state == ViewState.BusyLocal, onPressed: () async { // TODO MOSA TEST // AppPermissionsUtils @@ -339,37 +355,52 @@ class _PatientProfileScreenState extends State with Single // }); if (isCallFinished) { Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => EndCallScreen(patient: patient),settings: RouteSettings(name: 'EndCallScreen'),),); + context, + MaterialPageRoute( + builder: (BuildContext context) => + EndCallScreen(patient: patient), + settings: + RouteSettings(name: 'EndCallScreen'), + ), + ); } else { GifLoaderDialogUtils.showMyDialog(context); - await model.startCall(isReCall: false, vCID: patient.vcId); + await model.startCall( + isReCall: false, vCID: patient.vcId); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(model.error); } else { await model.getDoctorProfile(); - patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); + patient.appointmentNo = int.parse(model + .startCallRes.appointmentNo + .toString()); patient.episodeNo = 0; model.updateInCallPatient( patient: patient, - appointmentNo: int.parse(model.startCallRes.appointmentNo.toString())); + appointmentNo: int.parse(model + .startCallRes.appointmentNo + .toString())); setState(() { isCallStarted = true; }); GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils.requestVideoCallPermission( - context: context, - onTapGrant: () { - locator().openVideo( - model.startCallRes, - patient, - model.startCallRes != null ? model.startCallRes.isRecording : true, - callConnected, - callDisconnected); - }); + AppPermissionsUtils + .requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo( + model.startCallRes, + patient, + model.startCallRes != null + ? model.startCallRes + .isRecording + : true, + callConnected, + callDisconnected); + }); } } }, @@ -387,6 +418,36 @@ class _PatientProfileScreenState extends State with Single ), ); } + + createEpisode({PatiantInformtion patient, SOAPViewModel model}) async { + await locator().logEvent( + eventCategory: "Patient Profile", + eventAction: "Create Episode", + ); + GifLoaderDialogUtils.showMyDialog(context); + if (patient.admissionNo != null && patient.admissionNo.isNotEmpty) { + PostEpisodeForInpatientRequestModel postEpisodeReqModel = + PostEpisodeForInpatientRequestModel( + admissionNo: int.parse(patient.admissionNo), + patientID: patient.patientId); + await model.postEpisodeForInPatient(postEpisodeReqModel); + } else { + PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( + appointmentNo: int.parse(patient.appointmentNo.toString()), + patientMRN: patient.patientMRN); + + await model.postEpisode(postEpisodeReqModel); + } + + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } else { + patient.episodeNo = model.episodeID; + Navigator.of(context) + .pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); + } + } } class AvatarWidget extends StatelessWidget { @@ -398,7 +459,12 @@ class AvatarWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)], + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.08), + offset: Offset(0.0, 5.0), + blurRadius: 16.0) + ], borderRadius: BorderRadius.all(Radius.circular(35.0)), color: Color(0xffCCCCCC), ), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 210b237f..f1d29ffb 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -35,36 +35,69 @@ class ProfileGridForInPatient extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, + PatientProfileCardModel( + TranslationBase.of(context).vital, + TranslationBase.of(context).signs, + VITAL_SIGN_DETAILS, 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab, + TranslationBase.of(context).result, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).specialResult, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab, + TranslationBase.of(context).specialResult, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).result, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology, + TranslationBase.of(context).result, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).patient, + TranslationBase.of(context).prescription, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).progress, TranslationBase.of(context).note, PROGRESS_NOTE, + PatientProfileCardModel( + TranslationBase.of(context).progress, + TranslationBase.of(context).note, + PROGRESS_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), - PatientProfileCardModel(TranslationBase.of(context).order, TranslationBase.of(context).sheet, ORDER_NOTE, + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).order, + TranslationBase.of(context).sheet, + ORDER_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), - PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).orders, + TranslationBase.of(context).procedures, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health, + TranslationBase.of(context).summary, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).medical, TranslationBase.of(context).report, - PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', - isInPatient: isInpatient, isDisable: false), + PatientProfileCardModel( + TranslationBase.of(context).medical, + TranslationBase.of(context).report, + PATIENT_MEDICAL_REPORT, + 'patient/health_summary.png', + isInPatient: isInpatient, + isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, @@ -73,12 +106,19 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: isInpatient, isDisable: isDischargedPatient || isFromSearch, ), - PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).approvals, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance, + TranslationBase.of(context).approvals, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).discharge, TranslationBase.of(context).report, null, + PatientProfileCardModel( + TranslationBase.of(context).discharge, + TranslationBase.of(context).report, + null, 'patient/patient_sick_leave.png', - isInPatient: isInpatient, isDisable: true), + isInPatient: isInpatient, + isDisable: true), PatientProfileCardModel( TranslationBase.of(context).patientSick, TranslationBase.of(context).leave, @@ -90,30 +130,35 @@ class ProfileGridForInPatient extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), - child: StaggeredGridView.countBuilder( + child: GridView( shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - crossAxisCount: 3, - itemCount: cardsList.length, - staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, + + physics: BouncingScrollPhysics(), + // if you want IOS bouncing effect, otherwise remove this line + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisSpacing: 10, + mainAxisSpacing: 10, + crossAxisCount: 3, ), + //change the number as you want + children: cardsList.map((item) { + return PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: item.nameLine1, + nameLine2: item.nameLine2, + route: item.route, + icon: item.icon, + isInPatient: item.isInPatient, + isDischargedPatient: item.isDischargedPatient, + isDisable: item.isDisable, + onTap: item.onTap, + isLoading: item.isLoading, + ); + }).toList(), ), ); } 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 ed2a2d74..a0cdb39c 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 @@ -18,14 +18,12 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.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:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class AddAssessmentDetails extends StatefulWidget { @@ -121,15 +119,9 @@ class _AddAssessmentDetailsState extends State { heightFactor: 1, child: BaseView( onModelReady: (model) async { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - if (model.listOfICD10.length == 0) { - await model.getMasterLookup(MasterKeysService.ICD10); - } + + model.callAddAssessmentLookupsServices(); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 439cb61a..80cdc34c 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -1,6 +1,5 @@ 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'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -16,9 +15,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_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 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../shared_soap_widgets/SOAP_open_items.dart'; @@ -58,24 +55,10 @@ class _UpdateAssessmentPageState extends State onModelReady: (model) async { model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: '', - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString())); - await model.getPatientAssessment(getAssessmentReqModel); + + await model.onUpdateAssessmentStepStart(widget.patientInfo); + if (model.patientAssessmentList.isNotEmpty) { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - if (model.listOfICD10.length == 0) { - await model.getMasterLookup(MasterKeysService.ICD10); - } model.patientAssessmentList.forEach((element) { MasterKeyModel diagnosisType = model.getOneMasterKey( masterKeys: MasterKeysService.DiagnosisType, diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 5ce4250a..42b94656 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -1,4 +1,3 @@ -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'; @@ -9,10 +8,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.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:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'examinations_list_search_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 384aff90..9dd00302 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s 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'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ExaminationItemCard extends StatelessWidget { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 576c52c3..9712eafd 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -3,10 +3,9 @@ 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/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.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'; @@ -15,10 +14,8 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_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/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_open_items.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index d32634b2..37a6096e 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -2,7 +2,6 @@ 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/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; @@ -16,10 +15,8 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_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/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 8c68a61e..60c43d00 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -9,10 +9,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'master_key_checkbox_search_allergies_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index f663d92e..b10d831d 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -8,11 +8,9 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.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/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'priority_bar.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index 33e7fcd1..e00a83f5 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_s 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'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../shared_soap_widgets/SOAP_open_items.dart'; 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 67c1df55..553c2f17 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 @@ -13,13 +13,11 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; @@ -58,23 +56,7 @@ class _AddMedicationState extends State { return FractionallySizedBox( child: BaseView( onModelReady: (model) async { - if (model.medicationStrengthList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationStrength, - ); - } - if (model.medicationFrequencyList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationFrequency); - } - if (model.medicationDoseTimeList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationDoseTime); - } - if (model.medicationRouteList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationRoute); - } - if (model.allMedicationList.length == 0) - await model.getMedicationList(); + model.onAddMedicationStart(); }, builder: (_, model, w) => AppScaffold( 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 bf3e0988..72579790 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 @@ -3,15 +3,13 @@ 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/ChiefComplaint/GetChiefComplaintReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_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/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'; @@ -20,9 +18,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjecti import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; @@ -57,33 +53,7 @@ class _UpdateSubjectivePageState extends State implements getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); - - model.complaintsControllerError = ''; - model.medicationControllerError = ''; - model.illnessControllerError = ''; - GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); - - await model.getPatientHistories(getHistoryReqModel, isFirst: true); - if (model.patientHistoryList.isNotEmpty) { - if (model.historyFamilyList.isEmpty) { - await model.getMasterLookup(MasterKeysService.HistoryFamily); - } - if (model.historyMedicalList.isEmpty) { - await model.getMasterLookup(MasterKeysService.HistoryMedical); - } - if (model.historySurgicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySurgical); - } - if (model.historySportList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySports); - } - model.patientHistoryList.forEach((element) { if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( @@ -138,17 +108,8 @@ class _UpdateSubjectivePageState extends State implements } getAllergies(SOAPViewModel model) async { - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP); - if (model.patientAllergiesList.isNotEmpty) { - if (model.allergiesList.isEmpty) await model.getMasterLookup(MasterKeysService.Allergies); - if (model.allergySeverityList.isEmpty) await model.getMasterLookup(MasterKeysService.AllergySeverity); + if (model.patientAllergiesList.isNotEmpty) { model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); @@ -183,16 +144,8 @@ class _UpdateSubjectivePageState extends State implements myAllergiesList.clear(); myHistoryList.clear(); model.setSubjectiveCallBack(this); - GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( - admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, - patientMRN: widget.patientInfo.patientMRN, - appointmentNo: widget.patientInfo.appointmentNo != null - ? int.parse(widget.patientInfo.appointmentNo.toString()) - : null, - episodeId: widget.patientInfo.episodeNo, - episodeID: widget.patientInfo.episodeNo, - doctorID: ''); - await model.getPatientChiefComplaint(getChiefComplaintReqModel); + await model.onUpdateSubjectStepStart(widget.patientInfo); + if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 07c8caf7..a6740a2c 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,10 +1,7 @@ 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/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.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/base/base_view.dart'; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 05db2c07..118efbfb 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1101,6 +1101,8 @@ class TranslationBase { String get underProcess => localizedValues['underProcess'][locale.languageCode]; String get textResponse => localizedValues['textResponse'][locale.languageCode]; String get special => localizedValues['special'][locale.languageCode]; + String get requestType => localizedValues['requestType'][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index b86df45a..599e4e37 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/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:provider/provider.dart'; @@ -31,12 +32,9 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( bgColor: - widget.reply.infoStatus == 4 - ? IN_PROGRESS_COLOR - : widget.reply.infoStatus == 3 ?Color(0xFFD02127): Colors.green[600], + widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), hasBorder: false, widget: Container( - // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), child: InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -51,12 +49,15 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: 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:'' ,//widget.reply.status==2 ? "Active":widget.reply.status==1?"Hold":"Cancelled",//TranslationBase.of(context).replied :TranslationBase.of(context).unReplied , + text: widget.reply.status == 2 + ? TranslationBase.of(context).active + : widget.reply.status == 1 + ? TranslationBase.of(context).onHold + : TranslationBase.of(context).cancelled, style: TextStyle( - color: widget.reply.infoStatus == 4 - ? IN_PROGRESS_COLOR - : widget.reply.infoStatus == 3 ?Color(0xFFD02127): Colors.green[600], - + color: widget.reply.status == 2 + ? Colors.green[600] + : Color(0xFFD02127), fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 2.0 * SizeConfig.textMultiplier)), @@ -73,7 +74,7 @@ class _DoctorReplyWidgetState extends State { .toString() + " " + AppDateUtils.getMonth( - AppDateUtils.getDateTimeFromServerFormat( + AppDateUtils.getDateTimeFromServerFormat( widget.reply.createdOn) .month) .toString() @@ -88,18 +89,17 @@ class _DoctorReplyWidgetState extends State { ), AppText( AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) - .hour - .toString() - + ":"+ + widget.reply.createdOn) + .hour + .toString() + + ":" + AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn) .minute .toString(), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ) - ], ), ], @@ -109,7 +109,7 @@ class _DoctorReplyWidgetState extends State { children: [ Expanded( child: AppText( - Helpers.capitalize( widget.reply.patientName), + Helpers.capitalize(widget.reply.patientName), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -119,7 +119,7 @@ class _DoctorReplyWidgetState extends State { margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - launch("tel://" +widget.reply.mobileNumber); + launch("tel://" + widget.reply.mobileNumber); }, child: Icon( Icons.phone, @@ -163,7 +163,6 @@ class _DoctorReplyWidgetState extends State { fit: BoxFit.cover, ), ), - ], ), SizedBox( @@ -173,89 +172,91 @@ class _DoctorReplyWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: 10,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - - children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRow( + label: TranslationBase.of(context).fileNumber, + value: widget.reply.patientID.toString(), + ), - RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: TranslationBase.of(context).fileNumber, - style: TextStyle( - fontSize: 14,color: Color(0xFF575757),fontWeight: FontWeight.bold, fontFamily: 'Poppins')), - new TextSpan( - text: widget.reply.patientID.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 15)), - ], + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", ), - ), - Container( - width: MediaQuery.of(context).size.width*0.45, - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context).age + - " : ", - style: TextStyle(fontSize: 14,color: Color(0xFF575757),fontWeight: FontWeight.bold)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 15)), - ], - ), + 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, + ), + ], + ), + ], + ), - ], - ), - Container( - width: MediaQuery.of(context).size.width * 0.5, - child: RichText( - maxLines: 3, - overflow: TextOverflow.ellipsis, - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text:"Patient Question :" ,//TranslationBase.of(context).doctorResponse + " : ", - style: - TextStyle(fontSize: 14, fontFamily: 'Poppins', color: Color(0xFF575757),fontWeight: FontWeight.bold)), - new TextSpan( - text: widget.reply?.remarks?.trim()??'', - style: TextStyle( - fontFamily: 'Poppins', + Container( + width: MediaQuery.of(context).size.width * 0.5, + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + text: new TextSpan( + style: new TextStyle( + fontSize: + 1.3 * SizeConfig.textMultiplier, + color: Color(0xFF575757)), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .requestType + + ": ", + style: TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.8, color: Color(0xFF575757), - fontSize: 12)), - ], + //TranslationBase.of(context).doctorResponse + " : ", + )), + new TextSpan( + text: + "${widget.reply.requestTypeDescription}", + style: TextStyle( + fontFamily: 'Poppins', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + )), + ], + ), ), ), - ), - ],) + ], + ) ], ), // Container( diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index 745966f2..b86256fd 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/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'; @@ -382,36 +383,20 @@ class PatientCard extends StatelessWidget { "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", ), if (patientInfo.admissionDate != null) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context) - .roomNo + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: - "${patientInfo.roomId}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ]))), + CustomRow( + label: + TranslationBase.of(context).roomNo + " : ", + value: "${patientInfo.roomId}", + ), + if (isFromLiveCare) Column( children: [ - - CustomRow(label: TranslationBase.of(context) - .clinic + - " : ", - value: patientInfo.clinicName,), + CustomRow( + label: TranslationBase.of(context).clinic + + " : ", + value: patientInfo.clinicName, + ), ], ), ])) @@ -470,37 +455,4 @@ class PatientCard extends StatelessWidget { } } -class CustomRow extends StatelessWidget { - const CustomRow({ - Key key, - this.label, - this.value, - }) : super(key: key); - final String label; - final String value; - - @override - Widget build(BuildContext context) { - return Row( - children: [ - AppText( - label, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, - color: Color(0xFF575757), - fontWeight: FontWeight.w600, - ), - SizedBox( - width: 1, - ), - AppText( - value, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, - isCopyable: true, - ), - ], - ); - } -} diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index deeff358..d414f557 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -40,8 +40,8 @@ class CardWithBgWidget extends StatelessWidget { color: bgColor ?? HexColor('#58434F'), borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), - bottomLeft: Radius.circular(10),),), + topRight: Radius.circular(10), + bottomRight: Radius.circular(10),),), width: 10, ), bottom: 1, diff --git a/lib/widgets/shared/user-guid/CusomRow.dart b/lib/widgets/shared/user-guid/CusomRow.dart new file mode 100644 index 00000000..3768d34e --- /dev/null +++ b/lib/widgets/shared/user-guid/CusomRow.dart @@ -0,0 +1,43 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:flutter/material.dart'; + +import '../app_texts_widget.dart'; + +class CustomRow extends StatelessWidget { + const CustomRow({ + Key key, + this.label, + this.value, this.labelSize, this.valueSize, this.width, + }) : super(key: key); + + final String label; + final String value; + final double labelSize; + final double valueSize; + final double width; + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + label, + fontSize: labelSize??SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + value, + fontSize: valueSize??SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ); + } +} \ No newline at end of file