diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 3006662e..fe2723df 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -36,20 +36,21 @@ class BaseAppClient { }) async { String url = BASE_URL + endPoint; try { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - String token = await sharedPref.getString(TOKEN); - if (profile != null) { - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - if (body['DoctorID'] == null) - body['DoctorID'] = doctorProfile?.doctorID; - body['EditedBy'] = doctorProfile?.doctorID; - if (body['ProjectID'] == null) { - body['ProjectID'] = doctorProfile?.projectID; - } - if (body['ClinicID'] == null) - body['ClinicID'] = doctorProfile?.clinicID; - } - body['TokenID'] = token ?? ''; + //TODO change it edit By Jammal + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // String token = await sharedPref.getString(TOKEN); + // if (profile != null) { + // DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + // if (body['DoctorID'] == null) + body['DoctorID'] = 4709;//doctorProfile?.doctorID; + body['EditedBy'] = 4709;//doctorProfile?.doctorID; + //if (body['ProjectID'] == null) { + body['ProjectID'] = 15;//doctorProfile?.projectID; + // } + // if (body['ClinicID'] == null) + body['ClinicID'] = 1;//doctorProfile?.clinicID; + // } + body['TokenID'] = "@dm!n";//token ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -63,9 +64,10 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; + //await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaRefreshTokenID'] ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; + //await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); print("URL : $url"); print("Body : ${json.encode(body)}"); @@ -123,6 +125,9 @@ class BaseAppClient { } } } + if(error == null || error == "null" || error == "null\n"){ + return "This server not work probably in this time"; + } return error; } } diff --git a/lib/config/config.dart b/lib/config/config.dart index b8509f66..3cfb84c7 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -29,6 +29,8 @@ const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN_DATA = + 'Services/DoctorApplication.svc/REST/GetVitalSigns'; const GET_PATIENT_LAB_OREDERS = 'Services/DoctorApplication.svc/REST/GetPatientLabOreders'; const GET_PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; @@ -66,6 +68,9 @@ const GET_PENDING_REFERRAL_PATIENT = const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; +const RESPONSE_PENDING_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/CreateReferral'; + const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -125,7 +130,10 @@ const POST_CHIEF_COMPLAINT = const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; const POST_PROGRESS_NOTE = - '/Services/DoctorApplication.svc/REST/PostProgressNote'; + 'Services/DoctorApplication.svc/REST/PostProgressNote'; + +const POST_ASSESSMENT = + 'Services/DoctorApplication.svc/REST/PostAssessment'; const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetProcedure'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 50d32393..f2880c93 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -353,4 +353,26 @@ const Map> localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, + 'weight': {'en': "Weight", 'ar': 'الوزن'}, + 'kg': {'en': "kg", 'ar': 'كغ'}, + 'height': {'en': "Height", 'ar': 'الطول'}, + 'cm': {'en': "cm", 'ar': 'سم'}, + 'idealBodyWeight': {'en': "Ideal Body Weight", 'ar': 'وزن الجسم المثالي'}, + 'waistSize': {'en': "Waist Size", 'ar': 'مقاس الخصر'}, + 'inch': {'en': "Inch", 'ar': 'إنش'}, + 'headCircum': {'en': "Head Circum", 'ar': 'محيط الرأس'}, + 'leanBodyWeight': {'en': "Lean Body Weight", 'ar': 'وزن الجسم الهزيل'}, + 'bodyMassIndex': {'en': "Body Mass Index", 'ar': 'مؤشر كتلة الجسم'}, + 'method': {'en': "Method", 'ar': 'الطريقة'}, + 'pulseBeats': {'en': 'Pulse(beats/minute)', 'ar': ' (دقة/دقيقة)النبض'}, + 'rhythm': {'en': "Rhythm", 'ar': 'الإيقاع'}, + 'respBeats': {'en': 'RESP (beats/minute)', 'ar': ' (دقة/دقيقة)التنفس'}, + 'patternOfRespiration': {'en': "Pattern Of Respiration", 'ar': 'نمط التنفس'}, + 'bloodPressureDiastoleAndSystole': {'en': 'Blood Pressure (Sys, Dias)', 'ar': 'ضغط الدم (العظمى, الصغرى)'}, + 'cuffLocation': {'en': "Cuff Location", 'ar': 'موقع الكف'}, + 'cuffSize': {'en': "Cuff Size", 'ar': 'حجم الكف'}, + 'patientPosition': {'en': "Patient Position", 'ar': 'موقع المريض'}, + 'fio2': {'en': "FIO2(%)", 'ar': 'FIO2(%)'}, + 'sao2': {'en': "SAO2(%)", 'ar': 'SAO2(%)'}, + 'painManagement': {'en': "Pain Management", 'ar': 'إدارة الألم'}, }; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index a4010858..8f5d76f8 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -9,7 +9,8 @@ enum MasterKeysService { AllergySeverity, physiotherapyGoals, DiagnosisCondition, - DiagnosisType + DiagnosisType, + ICD10 } extension SelectedMasterKeysService on MasterKeysService { @@ -48,6 +49,9 @@ extension SelectedMasterKeysService on MasterKeysService { case MasterKeysService.DiagnosisType: return 35; break; + case MasterKeysService.ICD10: + return 2500; + break; } } } diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index e5d2023c..3219ef6a 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.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'; 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/post_physical_exam_request_model.dart'; @@ -86,4 +87,16 @@ class SOAPService extends LookupService { super.error = error; }, body: postProgressNoteRequestModel.toJson()); } + + Future postAssessment( + PostAssessmentRequestModel postAssessmentRequestModel) async { + hasError = false; + await baseAppClient.post(POST_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAssessmentRequestModel.toJson()); + } } diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index 78bc63dd..d2c4eb1f 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,9 +1,9 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; class BaseService { String error; @@ -30,10 +30,10 @@ class BaseService { } } - Future getPatientArrivalList(String date) async{ + Future getPatientArrivalList(String date,{String fromDate}) async{ hasError = false; Map body = Map(); - body['From'] = date; + body['From'] = fromDate == null ? date : fromDate; body['To'] = date; body['PageIndex'] = 0; body['PageSize'] = 0; diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 61f0c31e..d677201b 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -33,6 +33,7 @@ class LookupService extends BaseService { // List listOfPhysiotherapyGoals = []; List listOfDiagnosisType = []; List listOfDiagnosisCondition = []; + List listOfICD10 = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -120,6 +121,13 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; + case MasterKeysService.ICD10: + listOfICD10.clear(); + entryList.forEach((v) { + listOfICD10 + .add(MasterKeyModel.fromJson(v)); + }); + break; } } } diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index ad108c3b..a15ed05a 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -162,6 +162,31 @@ class PatientReferralService extends LookupService { ); } + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + hasError = false; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + Map body = Map(); + body['IsAccepted'] = isAccepted; + body['AppointmentNo'] = pendingReferral.sourceAppointmentNo; + body['PatientMRN'] = pendingReferral.patientID; + body['PatientName'] = pendingReferral.patientName; + body['ReferralResponse'] = pendingReferral.remarksFromSource; + body['SetupID'] = pendingReferral.sourceSetupID; + body['DoctorName'] = doctorProfile.doctorName; + + await baseAppClient.post( + RESPONSE_PENDING_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + Future makeReferral( PatientArrivalEntity patientArrivalEntity, String isoStringDate, diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart new file mode 100644 index 00000000..d508fec6 --- /dev/null +++ b/lib/core/service/patient-vital-signs-service.dart @@ -0,0 +1,72 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; + +class VitalSignsService extends BaseService{ + + List patientVitalSignList = []; + List patientVitalSignOrderdSubList = []; + VitalSignData patientVitalSigns; + + /*Future getPatientVitalSign(patient) async { + hasError = false; + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN, + onSuccess: (dynamic response, int statusCode) { + patientVitalSignList = []; + response['List_DoctorPatientVitalSign'].forEach((v) { + patientVitalSignList.add(new VitalSignResModel.fromJson(v)); + }); + + if (patientVitalSignList.length > 0) { + List patientVitalSignOrderdSubListTemp = []; + patientVitalSignOrderdSubListTemp = patientVitalSignList; + patientVitalSignOrderdSubListTemp + .sort((VitalSignResModel a, VitalSignResModel b) { + return b.vitalSignDate.microsecondsSinceEpoch - + a.vitalSignDate.microsecondsSinceEpoch; + }); + patientVitalSignOrderdSubList.clear(); + int length = patientVitalSignOrderdSubListTemp.length >= 20 + ? 20 + : patientVitalSignOrderdSubListTemp.length; + for (int x = 0; x < length; x++) { + patientVitalSignOrderdSubList + .add(patientVitalSignOrderdSubListTemp[x]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: patient, + ); + } // Vit*/ + + Future getPatientVitalSign(PatientArrivalEntity patientArrivalEntity) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patientArrivalEntity.patientMRN; + body['AppointmentNo'] = patientArrivalEntity.appointmentNo; + body['EpisodeID'] = patientArrivalEntity.episodeNo; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if(response['VitalSignsList'] != null){ + if(response['VitalSignsList']['entityList'] = null && (response['VitalSignsList']['entityList'] as List).length > 0){ + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } +} \ No newline at end of file diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e8cde824..422f554a 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.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'; 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/post_physical_exam_request_model.dart'; @@ -34,6 +35,7 @@ class SOAPViewModel extends BaseViewModel { List get physicalExaminationList => _SOAPService.physicalExaminationList; List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; + List get listOfICD10 => _SOAPService.listOfICD10; @@ -107,5 +109,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postAssessment(postAssessmentRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/core/viewModel/patient-doctor-referral-viewModel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart similarity index 92% rename from lib/core/viewModel/patient-doctor-referral-viewModel.dart rename to lib/core/viewModel/patient-referral-viewmodel.dart index edf74c50..9662a910 100644 --- a/lib/core/viewModel/patient-doctor-referral-viewModel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -107,12 +107,22 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + setState(ViewState.Busy); + await _referralPatientService.responseReferral(pendingReferral, isAccepted); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getPatientArrivalList(String date) async { setState(ViewState.Busy); await _referralPatientService.getPatientArrivalList(date); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart new file mode 100644 index 00000000..05c98f0e --- /dev/null +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -0,0 +1,100 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient-vital-signs-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; + +import '../../locator.dart'; + +class VitalSignsViewModel extends BaseViewModel { + VitalSignsService _vitalSignService = locator(); + + List get patientArrivalList => + _vitalSignService.patientArrivalList; + + VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; + + Future getPatientArrivalList(String date, PatiantInformtion patient, + {String fromDate}) async { + setState(ViewState.Busy); + await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); + if (_vitalSignService.hasError) { + error = _vitalSignService.error; + setState(ViewState.Error); + } else { + await getPatientVitalSign(patient); + } + } + + PatientArrivalEntity getPatientAppointmentEntity(PatiantInformtion patient) { + String ffName = "${patient.firstName} ${patient.lastName}"; + String fmfName = + "${patient.firstName} ${patient.middleName} ${patient.lastName}"; + + for (var element in patientArrivalList) { + int index = patientArrivalList.indexOf(element); + if (element.patientName == ffName || element.patientName == fmfName) { + return element; + } + // print("patient index: $index"); + } + return null; + } + + Future getPatientVitalSign(PatiantInformtion patient) async { + setState(ViewState.Busy); + PatientArrivalEntity patientArrivalEntity = + getPatientAppointmentEntity(patient); + if (patientArrivalEntity == null) { + _vitalSignService.hasError = true; + error = "There is no appointments for this patient"; + setState(ViewState.Error); + return; + } + await _vitalSignService.getPatientVitalSign(patientArrivalEntity); + // TODO remove (not) from below condition + if (!_vitalSignService.hasError) { + error = _vitalSignService.error; + setState(ViewState.Error); + } else { + if (patientVitalSigns == null) { + _vitalSignService.patientVitalSigns = VitalSignData( + appointmentNo: 2016053265, + bloodPressureCuffLocation: 0, + bloodPressureCuffSize: 0, + bloodPressureHigher: 38, + bloodPressureLower: 32, + bloodPressurePatientPosition: 1, + bodyMassIndex: 31.11, + fio2: 0, + headCircumCm: 0, + heightCm: 150, + idealBodyWeightLbs: -2, + isPainManagementDone: false, + isVitalsRequired: true, + leanBodyWeightLbs: 0, + painCharacter: null, + painDuration: null, + painFrequency: null, + painLocation: null, + painScore: 0, + patientMRN: 3333274, + patientType: 1, + pulseBeatPerMinute: 0, + pulseRhythm: 0, + respirationBeatPerMinute: 0, + respirationPattern: 0, + sao2: 0, + status: 47, + temperatureCelcius: 40, + temperatureCelciusMethod: 1, + waistSizeInch: 39, + weightKg: 70, + ); + } + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 267f823a..1448fb47 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -101,7 +101,7 @@ class ProjectViewModel with ChangeNotifier { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: {}); + }, body: Map()); return Future.value(localRes); } catch (error) { @@ -111,18 +111,18 @@ class ProjectViewModel with ChangeNotifier { } void getProfile() async { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: doctorProfile.clinicID, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); + // ProfileReqModel docInfo = new ProfileReqModel( + // doctorID: doctorProfile.doctorID, + // clinicID: doctorProfile.clinicID, + // license: true, + // projectID: doctorProfile.projectID, + // tokenID: '', + // languageID: 2); Provider.of(AppGlobal.CONTEX, listen: false) - .getDocProfiles(docInfo.toJson()) + .getDocProfiles(ProfileReqModel().toJson()) .then((res) async { sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); }).catchError((err) { diff --git a/lib/locator.dart b/lib/locator.dart index 52f93a71..8bbf00b0 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -13,6 +13,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/SOAP_service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; +import 'core/service/patient-vital-signs-service.dart'; import 'core/service/patient-doctor-referral-service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; @@ -20,7 +21,8 @@ import 'core/service/schedule_service.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; -import 'core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'core/viewModel/patient-referral-viewmodel.dart'; import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; @@ -42,6 +44,7 @@ void setupLocator() { locator.registerLazySingleton(() => PatientReferralService()); locator.registerLazySingleton(() => PrescriptionService()); locator.registerLazySingleton(() => ProcedureService()); + locator.registerLazySingleton(() => VitalSignsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -56,4 +59,5 @@ void setupLocator() { locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => ProcedureViewModel()); + locator.registerFactory(() => VitalSignsViewModel()); } diff --git a/lib/models/SOAP/master_key_model.dart b/lib/models/SOAP/master_key_model.dart index 79615f82..a1c32039 100644 --- a/lib/models/SOAP/master_key_model.dart +++ b/lib/models/SOAP/master_key_model.dart @@ -1,18 +1,18 @@ class MasterKeyModel { String alias; String aliasN; - int code; - Null description; - Null detail1; - Null detail2; - Null detail3; - Null detail4; - Null detail5; + dynamic code; + dynamic description; + dynamic detail1; + dynamic detail2; + dynamic detail3; + dynamic detail4; + dynamic detail5; int groupID; int id; String nameAr; String nameEn; - Null remarks; + dynamic remarks; int typeId; String valueList; diff --git a/lib/models/SOAP/post_assessment_request_model.dart b/lib/models/SOAP/post_assessment_request_model.dart new file mode 100644 index 00000000..c8a1ebfd --- /dev/null +++ b/lib/models/SOAP/post_assessment_request_model.dart @@ -0,0 +1,69 @@ +class PostAssessmentRequestModel { + int patientMRN; + int appointmentNo; + int episodeId; + List icdCodeDetails; + + PostAssessmentRequestModel( + {this.patientMRN, + this.appointmentNo, + this.episodeId, + this.icdCodeDetails}); + + PostAssessmentRequestModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + if (json['icdCodeDetails'] != null) { + icdCodeDetails = new List(); + json['icdCodeDetails'].forEach((v) { + icdCodeDetails.add(new IcdCodeDetails.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + if (this.icdCodeDetails != null) { + data['icdCodeDetails'] = + this.icdCodeDetails.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class IcdCodeDetails { + String icdcode10Id; + int conditionId; + int diagnosisTypeId; + bool complexDiagnosis; + String remarks; + + IcdCodeDetails( + {this.icdcode10Id, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + IcdCodeDetails.fromJson(Map json) { + icdcode10Id = json['icdcode10Id']; + conditionId = json['conditionId']; + diagnosisTypeId = json['diagnosisTypeId']; + complexDiagnosis = json['complexDiagnosis']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['icdcode10Id'] = this.icdcode10Id; + data['conditionId'] = this.conditionId; + data['diagnosisTypeId'] = this.diagnosisTypeId; + data['complexDiagnosis'] = this.complexDiagnosis; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart new file mode 100644 index 00000000..5d20e017 --- /dev/null +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -0,0 +1,136 @@ +class VitalSignData { + int appointmentNo; + int bloodPressureCuffLocation; + int bloodPressureCuffSize; + int bloodPressureHigher; + int bloodPressureLower; + int bloodPressurePatientPosition; + double bodyMassIndex; + int fio2; + int headCircumCm; + int heightCm; + int idealBodyWeightLbs; + bool isPainManagementDone; + bool isVitalsRequired; + int leanBodyWeightLbs; + String painCharacter; + String painDuration; + String painFrequency; + String painLocation; + int painScore; + int patientMRN; + int patientType; + int pulseBeatPerMinute; + int pulseRhythm; + int respirationBeatPerMinute; + int respirationPattern; + int sao2; + int status; + int temperatureCelcius; + int temperatureCelciusMethod; + int waistSizeInch; + int weightKg; + + VitalSignData( + {this.appointmentNo, + this.bloodPressureCuffLocation, + this.bloodPressureCuffSize, + this.bloodPressureHigher, + this.bloodPressureLower, + this.bloodPressurePatientPosition, + this.bodyMassIndex, + this.fio2, + this.headCircumCm, + this.heightCm, + this.idealBodyWeightLbs, + this.isPainManagementDone, + this.isVitalsRequired, + this.leanBodyWeightLbs, + this.painCharacter, + this.painDuration, + this.painFrequency, + this.painLocation, + this.painScore, + this.patientMRN, + this.patientType, + this.pulseBeatPerMinute, + this.pulseRhythm, + this.respirationBeatPerMinute, + this.respirationPattern, + this.sao2, + this.status, + this.temperatureCelcius, + this.temperatureCelciusMethod, + this.waistSizeInch, + this.weightKg}); + + VitalSignData.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + bloodPressureCuffLocation = json['bloodPressureCuffLocation']; + bloodPressureCuffSize = json['bloodPressureCuffSize']; + bloodPressureHigher = json['bloodPressureHigher']; + bloodPressureLower = json['bloodPressureLower']; + bloodPressurePatientPosition = json['bloodPressurePatientPosition']; + bodyMassIndex = json['bodyMassIndex']; + fio2 = json['fio2']; + headCircumCm = json['headCircumCm']; + heightCm = json['heightCm']; + idealBodyWeightLbs = json['idealBodyWeightLbs']; + isPainManagementDone = json['isPainManagementDone']; + isVitalsRequired = json['isVitalsRequired']; + leanBodyWeightLbs = json['leanBodyWeightLbs']; + painCharacter = json['painCharacter']; + painDuration = json['painDuration']; + painFrequency = json['painFrequency']; + painLocation = json['painLocation']; + painScore = json['painScore']; + patientMRN = json['patientMRN']; + patientType = json['patientType']; + pulseBeatPerMinute = json['pulseBeatPerMinute']; + pulseRhythm = json['pulseRhythm']; + respirationBeatPerMinute = json['respirationBeatPerMinute']; + respirationPattern = json['respirationPattern']; + sao2 = json['sao2']; + status = json['status']; + temperatureCelcius = json['temperatureCelcius']; + temperatureCelciusMethod = json['temperatureCelciusMethod']; + waistSizeInch = json['waistSizeInch']; + weightKg = json['weightKg']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['bloodPressureCuffLocation'] = this.bloodPressureCuffLocation; + data['bloodPressureCuffSize'] = this.bloodPressureCuffSize; + data['bloodPressureHigher'] = this.bloodPressureHigher; + data['bloodPressureLower'] = this.bloodPressureLower; + data['bloodPressurePatientPosition'] = this.bloodPressurePatientPosition; + data['bodyMassIndex'] = this.bodyMassIndex; + data['fio2'] = this.fio2; + data['headCircumCm'] = this.headCircumCm; + data['heightCm'] = this.heightCm; + data['idealBodyWeightLbs'] = this.idealBodyWeightLbs; + data['isPainManagementDone'] = this.isPainManagementDone; + data['isVitalsRequired'] = this.isVitalsRequired; + data['leanBodyWeightLbs'] = this.leanBodyWeightLbs; + data['painCharacter'] = this.painCharacter; + data['painDuration'] = this.painDuration; + data['painFrequency'] = this.painFrequency; + data['painLocation'] = this.painLocation; + data['painScore'] = this.painScore; + data['patientMRN'] = this.patientMRN; + data['patientType'] = this.patientType; + data['pulseBeatPerMinute'] = this.pulseBeatPerMinute; + data['pulseRhythm'] = this.pulseRhythm; + data['respirationBeatPerMinute'] = this.respirationBeatPerMinute; + data['respirationPattern'] = this.respirationPattern; + data['sao2'] = this.sao2; + data['status'] = this.status; + data['temperatureCelcius'] = this.temperatureCelcius; + data['temperatureCelciusMethod'] = this.temperatureCelciusMethod; + data['waistSizeInch'] = this.waistSizeInch; + data['weightKg'] = this.weightKg; + return data; + } +} diff --git a/lib/root_page.dart b/lib/root_page.dart index fe35a246..0f44dc4d 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -22,7 +22,7 @@ class RootPage extends StatelessWidget { ); break; case APP_STATUS.UNAUTHENTICATED: - return Loginsreen(); + return LandingPage(); break; case APP_STATUS.AUTHENTICATED: return LandingPage(); diff --git a/lib/routes.dart b/lib/routes.dart index 3fbec294..09e08b0e 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -44,6 +44,7 @@ import 'screens/live_care/panding_list.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; import 'screens/prescription/prescription_screen.dart'; +import 'screens/patients/profile/vital_sign/vital-signs-screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -79,6 +80,8 @@ const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String CREATE_EPISODE = 'patients/create-episode'; +const String PATIENT_VITAL_SIGN = 'patients/vital-sign-data'; +const String UPDATE_EPISODE = 'patients/create-episode'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -89,6 +92,7 @@ const String ORDER_PROCEDURE = 'procedure/procedure'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; const String ADD_SICKLEAVE = 'add-sickleave'; +//todo: change the routing way. var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -121,7 +125,9 @@ var routes = { PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), + PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), CREATE_EPISODE: (_) => AddSOAPIndex(), + UPDATE_EPISODE: (_) => AddSOAPIndex(isUpdate: true,), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b6bbc6cf..c55b5afa 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -115,68 +115,69 @@ class _DashboardScreenState extends State { SizedBox( height: 4, ), - InkWell( - onTap: () async { - showCupertinoPicker( - decKey: '', - context: context, - actionList: projectsProvider - .doctorClinicsList); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: AppText( - authProvider.selectedClinicName != - null - ? authProvider - .selectedClinicName - : authProvider.doctorProfile - .clinicDescription, - fontSize: - SizeConfig.textMultiplier * - 1.7, - color: Colors.white, - textAlign: TextAlign.center, - ), - alignment: projectsProvider.isArabic - ? Alignment.topRight - : Alignment.topLeft, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - child: Container( - margin: EdgeInsets.only( - left: 5, - top: projectsProvider - .isArabic - ? 0 - : 5, - right: 10, - bottom: projectsProvider - .isArabic - ? 15 - : 7), - child: Icon( - DoctorApp.sync_icon, - color: Colors.white, - size: SizeConfig - .textMultiplier * - 1.8, - )), - ), - ], - ), - ]), - ), + //TODO change it edit By Jammal + // InkWell( + // onTap: () async { + // showCupertinoPicker( + // decKey: '', + // context: context, + // actionList: projectsProvider + // .doctorClinicsList); + // }, + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Container( + // child: AppText( + // authProvider.selectedClinicName != + // null + // ? authProvider + // .selectedClinicName + // : authProvider.doctorProfile + // .clinicDescription, + // fontSize: + // SizeConfig.textMultiplier * + // 1.7, + // color: Colors.white, + // textAlign: TextAlign.center, + // ), + // alignment: projectsProvider.isArabic + // ? Alignment.topRight + // : Alignment.topLeft, + // ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // InkWell( + // child: Container( + // margin: EdgeInsets.only( + // left: 5, + // top: projectsProvider + // .isArabic + // ? 0 + // : 5, + // right: 10, + // bottom: projectsProvider + // .isArabic + // ? 15 + // : 7), + // child: Icon( + // DoctorApp.sync_icon, + // color: Colors.white, + // size: SizeConfig + // .textMultiplier * + // 1.8, + // )), + // ), + // ], + // ), + // ]), + // ), ], ), ]), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index b39493cf..4da282ae 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -286,7 +286,7 @@ class _PatientsScreenState extends State { setState(() { _isError = true; _isLoading = false; - this.error = error; + this.error = error.toString(); }); }); }, diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 3d2b5202..4c9d41e0 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -119,7 +119,9 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: null, + handler: (){ + model.responseReferral(pendingReferral, true); + }, ), ), SizedBox( @@ -133,7 +135,9 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: null, + handler: (){ + model.responseReferral(pendingReferral, false); + }, ), ), ], diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index 5a91ac51..7f11f35f 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index b6287cd9..7a210b98 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,11 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -17,7 +19,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../QR_reader_screen.dart'; class PatientMakeReferralScreen extends StatefulWidget { - // previous design page is: ReferPatientScreen + // previous design page is: MyReferralPatient @override _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); @@ -64,14 +66,7 @@ class _PatientMakeReferralScreenState extends State { children: [ Column( children: [ - Container( - height: 75, - child: AppText( - "This is where upper view for avatar.. etc placed", - fontWeight: FontWeight.normal, - fontSize: 16, - ), - ), + PatientPageHeaderWidget(patient), const Divider( color: Color(0xffCCCCCC), height: 1, @@ -336,13 +331,15 @@ class _PatientMakeReferralScreenState extends State { _selectedClinic == null || _selectedDoctor == null || _remarksController.text == null) return; - model.makeReferral( - _selectedPatientArrivalEntity, - appointmentDate.toIso8601String(), - _selectedBranch['ID'], - _selectedClinic['ClinicID'], - _selectedDoctor['DoctorID'], - _remarksController.text).then((_) => Navigator.pop(context)); + model + .makeReferral( + _selectedPatientArrivalEntity, + appointmentDate.toIso8601String(), + _selectedBranch['ID'], + _selectedClinic['ClinicID'], + _selectedDoctor['DoctorID'], + _remarksController.text) + .then((_) => Navigator.pop(context)); }, ), ) @@ -360,7 +357,7 @@ class _PatientMakeReferralScreenState extends State { final DateTime picked = await showDatePicker( context: context, initialDate: appointmentDate, - firstDate: appointmentDate.add(Duration(hours: 2)), + firstDate: DateTime.now().add(Duration(hours: 2)), lastDate: DateTime(2040), initialEntryMode: DatePickerEntryMode.calendar, ); @@ -370,6 +367,10 @@ class _PatientMakeReferralScreenState extends State { .getPatientArrivalList(DateUtils.convertStringToDateFormat( appointmentDate.toString(), "yyyy-MM-dd")) .then((_) { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + return; + } if (model.patientArrivalList != null && model.patientArrivalList.length > 0) { List appointments = model.getAppointmentsByPatientName( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 9fc5b4f8..1ba1f572 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart new file mode 100644 index 00000000..c6b183b7 --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -0,0 +1,989 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:flutter/material.dart'; + +class PatientVitalSignScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return BaseView( + onModelReady: (model) => model.getPatientArrivalList( + DateUtils.convertDateToFormat(DateTime.now(), "yyyy-MM-dd"), patient, + fromDate: DateUtils.convertDateToFormat( + DateTime.now().subtract(Duration(days: 500)), "yyyy-MM-dd")), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).vitalSign, + body: model.patientVitalSigns != null + ? SingleChildScrollView( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + SizedBox( + height: 16, + ), + Container( + margin: + EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).weight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.weightKg} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).idealBodyWeight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.idealBodyWeightLbs} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).height} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.heightCm} ${TranslationBase.of(context).cm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).waistSize} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.waistSizeInch} ${TranslationBase.of(context).inch}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).headCircum} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.headCircumCm} ${TranslationBase.of(context).cm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).leanBodyWeight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.leanBodyWeightLbs} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).bodyMassIndex} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bodyMassIndex}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "G.C.S :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "N/A", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + TemperatureWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + PulseWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + RespirationWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + BloodPressureWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + OxygenationWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + PainScaleWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ), + ) + ], + ), + ), + ) + : Container(), + ), + ); + } +} + +class TemperatureWidget extends StatefulWidget { + final VitalSignData vitalSign; + + TemperatureWidget(this.vitalSign); + + @override + _TemperatureWidgetState createState() => _TemperatureWidgetState(); +} + +class _TemperatureWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature} (C):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.temperatureCelcius}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature} (F):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).method} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.temperatureCelciusMethod}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class PulseWidget extends StatefulWidget { + + final VitalSignData vitalSign; + + PulseWidget(this.vitalSign); + + @override + _PulseWidgetState createState() => _PulseWidgetState(); +} + +class _PulseWidgetState extends State { + bool isExpand = false; + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).pulse}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).rhythm}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.pulseRhythm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class RespirationWidget extends StatefulWidget { + + final VitalSignData vitalSign; + + RespirationWidget(this.vitalSign); + + @override + _RespirationWidgetState createState() => _RespirationWidgetState(); +} + +class _RespirationWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).respiration}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).respBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.respirationBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).patternOfRespiration}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.respirationPattern}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class BloodPressureWidget extends StatefulWidget { + + final VitalSignData vitalSign; + + BloodPressureWidget(this.vitalSign); + + @override + _BloodPressureWidgetState createState() => _BloodPressureWidgetState(); +} + +class _BloodPressureWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).bloodPressure}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffLocation}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffLocation}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).patientPosition}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressurePatientPosition}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffSize}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffSize}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class OxygenationWidget extends StatefulWidget { + + final VitalSignData vitalSign; + + OxygenationWidget(this.vitalSign); + + @override + _OxygenationWidgetState createState() => _OxygenationWidgetState(); +} + +class _OxygenationWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).oxygenation}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).sao2}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.sao2}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).fio2}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.fio2}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class PainScaleWidget extends StatefulWidget { + + final VitalSignData vitalSign; + + PainScaleWidget(this.vitalSign); + + @override + _PainScaleWidgetState createState() => _PainScaleWidgetState(); +} + +class _PainScaleWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.painScore}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).painManagement}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.isPainManagementDone}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + + + + + diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index f0f03ed8..5d651bad 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -2,9 +2,13 @@ import 'package:intl/intl.dart'; class DateUtils { + static String convertDateToFormat(DateTime dateTime, String dateFormat) { + return DateFormat(dateFormat).format(dateTime); + } + static String convertStringToDateFormat(String date, String dateFormat) { DateTime dateTime = DateTime.parse(date); - return DateFormat(dateFormat).format(dateTime); + return convertDateToFormat(dateTime, dateFormat); } static convertDateFromServerFormat(String str, dateFormat) { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 59eda9e0..19818a0c 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -390,6 +390,28 @@ class TranslationBase { String get addMedication => localizedValues['addMedication'][locale.languageCode]; String get route => localizedValues['route'][locale.languageCode]; + String get weight => localizedValues['weight'][locale.languageCode]; + String get kg => localizedValues['kg'][locale.languageCode]; + String get height => localizedValues['height'][locale.languageCode]; + String get cm => localizedValues['cm'][locale.languageCode]; + String get idealBodyWeight => localizedValues['idealBodyWeight'][locale.languageCode]; + String get waistSize => localizedValues['waistSize'][locale.languageCode]; + String get inch => localizedValues['inch'][locale.languageCode]; + String get headCircum => localizedValues['headCircum'][locale.languageCode]; + String get leanBodyWeight => localizedValues['leanBodyWeight'][locale.languageCode]; + String get bodyMassIndex => localizedValues['bodyMassIndex'][locale.languageCode]; + String get method => localizedValues['method'][locale.languageCode]; + String get pulseBeats => localizedValues['pulseBeats'][locale.languageCode]; + String get rhythm => localizedValues['rhythm'][locale.languageCode]; + String get respBeats => localizedValues['respBeats'][locale.languageCode]; + String get patternOfRespiration => localizedValues['patternOfRespiration'][locale.languageCode]; + String get bloodPressureDiastoleAndSystole => localizedValues['bloodPressureDiastoleAndSystole'][locale.languageCode]; + String get cuffLocation => localizedValues['cuffLocation'][locale.languageCode]; + String get cuffSize => localizedValues['cuffSize'][locale.languageCode]; + String get patientPosition => localizedValues['patientPosition'][locale.languageCode]; + String get fio2 => localizedValues['fio2'][locale.languageCode]; + String get sao2 => localizedValues['sao2'][locale.languageCode]; + String get painManagement => localizedValues['painManagement'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index a6f792c8..09d86fd8 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -22,6 +23,9 @@ import '../patient_profile_widget.dart'; import 'steps_widget.dart'; class AddSOAPIndex extends StatefulWidget { + final bool isUpdate; + + const AddSOAPIndex({Key key, this.isUpdate}) : super(key: key); @override _AddSOAPIndexState createState() => _AddSOAPIndexState(); } @@ -63,74 +67,7 @@ class _AddSOAPIndexState extends State child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).age, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 20, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - Container( - width: MediaQuery.of(context).size.width *0.65, - child: AppText( - "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ), - ], - ) - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - width: 20, - ), + PatientPageHeaderWidget(patient), FractionallySizedBox( child: SingleChildScrollView( child: Container( diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 3bd9f0f1..22778913 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,8 +1,11 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/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/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -236,7 +239,7 @@ class _AssessmentPageState extends State { height: 6, ), AppText( - "Some short remark about the allergy", + widget.mySelectedAssessment.remark, fontSize: 10, color: Colors.grey, ), @@ -268,7 +271,9 @@ class _AssessmentPageState extends State { Column( children: [ InkWell( - onTap: () {}, + onTap: () { + openAssessmentDialog(context); + }, child: Icon(EvaIcons .edit2Outline), ) @@ -283,24 +288,55 @@ class _AssessmentPageState extends State { isExpand: isAssessmentExpand, ), DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase - .of(context) - .next, - onPressed: () { - widget.changePageViewIndex(3); - }, - ), - SizedBox( - height: 30, - ), - ], + height: 30, ), - ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitAssessment(model); + }, + ), + SizedBox( + height: 30, + ), + ], ), - ))); + ), + ), + ))); + } + + submitAssessment(SOAPViewModel model) async { + // if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && + // widget.mySelectedAssessment.selectedDiagnosisType != null) { + // PostAssessmentRequestModel postAssessmentRequestModel = + // new PostAssessmentRequestModel( + // patientMRN: 3120690, + // episodeId: 200012117, + // appointmentNo: 2016054573, + // icdCodeDetails: [ + // new IcdCodeDetails( + // remarks: widget.mySelectedAssessment.remark, + // complexDiagnosis: true, + // conditionId: + // widget.mySelectedAssessment.selectedDiagnosisCondition.id, + // diagnosisTypeId: + // widget.mySelectedAssessment.selectedDiagnosisType.id, + // icdcode10Id: "1") + // ]); + // + // await model.postAssessment(postAssessmentRequestModel); + // + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(3); + // } + // } else { + // helpers.showErrorToast('Please add required field correctly'); + // } + widget.changePageViewIndex(3); } openAssessmentDialog(BuildContext context) { @@ -334,14 +370,15 @@ class AddAssessmentDetails extends StatefulWidget { } class _AddAssessmentDetailsState extends State { - MasterKeyModel _selectedDiagnosisCondition; - MasterKeyModel _selectedDiagnosisType; + // MasterKeyModel _selectedDiagnosisCondition; + // MasterKeyModel _selectedDiagnosisType; TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController( text: "234567"); @override Widget build(BuildContext context) { + remarkController.text = widget.mySelectedAssessment.remark??""; final screenSize = MediaQuery .of(context) .size; @@ -379,6 +416,9 @@ class _AddAssessmentDetailsState extends State { if (model.listOfDiagnosisType.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisType); } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } }, builder: (_, model, w) => AppScaffold( @@ -428,45 +468,48 @@ class _AddAssessmentDetailsState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.listOfDiagnosisCondition != - null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - _selectedDiagnosisCondition = - selectedValue; - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Condition", - _selectedDiagnosisCondition != null - ? _selectedDiagnosisCondition - .nameEn - : null, - true), - enabled: false, - ), - ), + onTap: model.listOfICD10 != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + isICD: true, + list: model.listOfICD10, + selectedValue: widget + .mySelectedAssessment + .selectedICD, + okText: TranslationBase + .of(context) + .ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment + .selectedICD = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Name / ICD", + widget.mySelectedAssessment + .selectedICD != + null + ? widget.mySelectedAssessment + .selectedICD.nameEn + : null, + true), + enabled: false, + ), + ), ), SizedBox( height: 10, @@ -485,7 +528,8 @@ class _AddAssessmentDetailsState extends State { okFunction: ( MasterKeyModel selectedValue) { setState(() { - _selectedDiagnosisCondition = + widget.mySelectedAssessment + .selectedDiagnosisCondition = selectedValue; }); }, @@ -502,8 +546,10 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Condition", - _selectedDiagnosisCondition != null - ? _selectedDiagnosisCondition + widget.mySelectedAssessment + .selectedDiagnosisCondition != null + ? widget.mySelectedAssessment + .selectedDiagnosisCondition .nameEn : null, true), @@ -527,11 +573,11 @@ class _AddAssessmentDetailsState extends State { okFunction: ( MasterKeyModel selectedValue) { setState(() { - _selectedDiagnosisType = - selectedValue; + // _selectedDiagnosisType = + // selectedValue; widget.mySelectedAssessment .selectedDiagnosisType = - _selectedDiagnosisType; + selectedValue; }); }, ); @@ -547,8 +593,10 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Type", - _selectedDiagnosisType != null - ? _selectedDiagnosisType.nameEn + widget.mySelectedAssessment + .selectedDiagnosisType != null + ? widget.mySelectedAssessment + .selectedDiagnosisType.nameEn : null, true), enabled: false, diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index add9ca16..8d12e1c9 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -320,43 +320,47 @@ class _ObjectivePageState extends State { } submitObjectivePage(SOAPViewModel model) async { - if(widget.mySelectedExamination.isNotEmpty){ - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + // if(widget.mySelectedExamination.isNotEmpty){ + // PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + // widget.mySelectedExamination.forEach((exam) { + // if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + // null) + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + // + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + // ListHisProgNotePhysicalExaminationVM( + // patientMRN: 3120690, + // episodeId: 200012117, + // appointmentNo: 2016054573, + // remarks: exam.remark ?? '', + // createdBy: 1485, + // createdOn: DateTime.now().toIso8601String(), + // editedBy: 1485, + // editedOn: DateTime.now().toIso8601String(), + // examId: exam.selectedExamination.id, + // examType: exam.selectedExamination.typeId, + // isAbnormal: exam.isAbnormal, + // isNormal: exam.isNormal, + // masterDescription: exam.selectedExamination, + // notExamined: false + // + // )); + // }); + // + // await model.postPhysicalExam(postPhysicalExamRequestModel); + // + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(2); + // } + // } else { + // helpers.showErrorToast('Please add required field correctly'); + // } - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - ListHisProgNotePhysicalExaminationVM( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - remarks: exam.remark ?? '', - createdBy: 1485, - createdOn: DateTime.now().toIso8601String(), - editedBy: 1485, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false - - )); - }); - - await model.postPhysicalExam(postPhysicalExamRequestModel); + widget.changePageViewIndex(2); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - } - } - // TODO move it back to else stat when it work. - widget.changePageViewIndex(2); } diff --git a/lib/widgets/patients/profile/SOAP/steps_widget.dart b/lib/widgets/patients/profile/SOAP/steps_widget.dart index 863da3a9..d5cb7ddc 100644 --- a/lib/widgets/patients/profile/SOAP/steps_widget.dart +++ b/lib/widgets/patients/profile/SOAP/steps_widget.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -70,10 +71,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 0 ? 5 : 10, ), - Texts('SUBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "SUBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -82,7 +84,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.28, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -119,10 +121,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 1 ? 5 : 10, ), - Texts('OBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "OBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -131,7 +134,10 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.52, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(3) : null, + onTap: () { + if(index >= 3) + changeCurrentTab(2); + }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -168,10 +174,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 2 ? 5 : 10, ), - Texts('ASSESSMENT', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "ASSESSMENT", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -212,15 +219,20 @@ class StepsWidget extends StatelessWidget { ? Colors.white : Colors.grey, ), - ), + ) ), SizedBox( height: index == 3 ? 5 : 10, ), - Texts('PLAN', - variant: "bodyText", - bold: true, - color: Colors.black), + Container( + margin: EdgeInsets.only(left: index == 3? 15:0), + child: AppText( + "PLAN", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: 14, + ), + ), ], ), ), @@ -274,18 +286,19 @@ class StepsWidget extends StatelessWidget { color: index == 0 ? Colors.black : index > 0 - ? Colors.white - : Colors.grey, + ? Colors.white + : Colors.grey, ), ), ), SizedBox( height: index == 0 ? 5 : 10, ), - Texts('SUBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "SUBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 16, + ), ], ), ), @@ -331,10 +344,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 1 ? 5 : 10, ), - Texts('OBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "OBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -343,7 +357,7 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.52, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(3) : null, + onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -383,10 +397,11 @@ class StepsWidget extends StatelessWidget { Padding( padding: const EdgeInsets.only(right: 2), - child: Texts('ASSESSMENT', - variant: "bodyText", - bold: true, - color: Colors.black), + child: AppText( + "ASSESSMENT", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ), ], ), @@ -433,10 +448,14 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 3 ? 5 : 10, ), - Texts('PLAN', - variant: "bodyText", - bold: true, - color: Colors.black), + Container( + margin: EdgeInsets.only(right:index == 3? 15:0), + child: AppText( + "PLAN", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ), ], ), ), diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index 9100cb76..d4ed9c86 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -168,11 +168,6 @@ class _SubjectivePageState extends State { variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : false, color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) ], ), InkWell( @@ -214,11 +209,6 @@ class _SubjectivePageState extends State { variant: isAllergiesExpand ? "bodyText" : '', bold: isAllergiesExpand ? true : false, color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) ], ), InkWell( @@ -277,13 +267,48 @@ class _SubjectivePageState extends State { {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - await postChiefComplaint(model: model); - if (myHistoryList.length != 0) - await postHistories(model: model, myHistoryList: myHistoryList); - if (myAllergiesList.length != 0) - await postAllergy(myAllergiesList: myAllergiesList, model: model); + formKey.currentState.save(); + formKey.currentState.validate(); widget.changePageViewIndex(1); + + // if(complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length>25) { + // await postChiefComplaint(model: model); + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // if (myHistoryList.length != 0) { + // await postHistories(model: model, myHistoryList: myHistoryList); + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // if (myAllergiesList.length != 0) { + // await postAllergy(myAllergiesList: myAllergiesList, model: model); + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(1); + // } + // } + // + // } + // } else { + // if (myAllergiesList.length != 0) { + // await postAllergy(myAllergiesList: myAllergiesList, model: model); + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(1); + // } + // } else { + // widget.changePageViewIndex(1); + // } + // } + // } + // } else { + // helpers.showErrorToast('Please add required field correctly'); + // } + } postAllergy( @@ -362,9 +387,6 @@ class _SubjectivePageState extends State { await model.postChiefComplaint(postChiefComplaintRequestModel); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } } } diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart new file mode 100644 index 00000000..1567487d --- /dev/null +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -0,0 +1,92 @@ +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientPageHeaderWidget extends StatelessWidget { + + final PatiantInformtion patient; + + PatientPageHeaderWidget(this.patient); + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + AppText( + "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ], + ), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + width: 20, + ), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index fae705f4..90141080 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -43,7 +43,8 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - 'Dr. ${authProvider.doctorProfile.doctorName}', + //TODO change it edit By Jammal + 'Dr. ',//${authProvider.doctorProfile.doctorName}', fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, color: Colors.white, @@ -71,7 +72,9 @@ final double height; height: 50, width: 60, child: Image.network( - authProvider.doctorProfile.doctorImageURL, + //TODO change it edit By Jammal + 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg' + // authProvider.doctorProfile.doctorImageURL, // fit: BoxFit.fill, ), ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 9b70ae3a..20038540 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -18,6 +18,7 @@ import 'PatientProfileButton.dart'; *@desc: Profile Medical Info Widget */ class ProfileMedicalInfoWidget extends StatelessWidget { + ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); PatiantInformtion patient; @override @@ -35,12 +36,19 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: "Episode", route: CREATE_EPISODE, icon: 'heartbeat.png'), + PatientProfileButton( + key: key, + patient: patient, + nameLine1: "Update", + nameLine2: "Episode", + route: CREATE_EPISODE, + icon: 'heartbeat.png'), PatientProfileButton( key: key, patient: patient, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, + route: PATIENT_VITAL_SIGN, icon: 'heartbeat.png'), PatientProfileButton( key: key, diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index a276c4af..a3be364b 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -2,16 +2,20 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +// ignore: must_be_immutable class MasterKeyDailog extends StatefulWidget { final List list; final okText; final Function(MasterKeyModel) okFunction; MasterKeyModel selectedValue; + final bool isICD; MasterKeyDailog( {@required this.list, @required this.okText, - @required this.okFunction}); + @required this.okFunction, + this.selectedValue, + this.isICD = false}); @override _MasterKeyDailogState createState() => _MasterKeyDailogState(); @@ -62,17 +66,23 @@ class _MasterKeyDailogState extends State { children: [ ...widget.list .map((item) => RadioListTile( - title: Text(item.nameEn.toString()), - groupValue: widget.selectedValue.id.toString(), - value: item.id.toString(), - activeColor: Colors.blue.shade700, - selected: item.id.toString() == widget.selectedValue.id.toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) + title: Text( + '${item.nameEn}' + (widget.isICD ? '/${item.code}' : '')), + groupValue: widget.isICD + ? widget.selectedValue.code.toString() + : widget.selectedValue.id.toString(), + value: widget.isICD ? widget.selectedValue.code.toString() : item + .id.toString(), + activeColor: Colors.blue.shade700, + selected: widget.isICD ? item.code.toString() == + widget.selectedValue.code.toString() : item.id.toString() == + widget.selectedValue.id.toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) .toList() ], ), diff --git a/pubspec.lock b/pubspec.lock index ce581365..17f02b95 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -63,7 +63,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" build_config: dependency: transitive description: @@ -91,21 +91,21 @@ packages: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "1.5.1" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.10.9" + version: "1.10.11" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.4" + version: "6.1.5" build_web_compilers: dependency: "direct dev" description: @@ -433,7 +433,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -552,7 +552,7 @@ packages: name: percent_indicator url: "https://pub.dartlang.org" source: hosted - version: "2.1.8" + version: "2.1.9" permission_handler: dependency: "direct main" description: