diff --git a/assets/images/sick_leaves_icons.png b/assets/images/sick_leaves_icons.png new file mode 100644 index 00000000..67a9c937 Binary files /dev/null and b/assets/images/sick_leaves_icons.png differ diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 43a07ae4..ed14ecac 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -65,8 +65,8 @@ class BaseAppClient { 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['VidaRefreshTokenID'] = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); print("URL : $url"); print("Body : ${json.encode(body)}"); @@ -79,28 +79,31 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - print("status: $statusCode}"); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - print("IsAuthenticated? ${parsed['IsAuthenticated']}"); - if (!parsed['IsAuthenticated']) { - await helpers.logout(); - helpers.showErrorToast('Your session expired Please login again'); - } else if (parsed['MessageStatus'] == 1) { + // if (!parsed['IsAuthenticated']) { + // // TODO: return it back when IsAuthenticated work fine in all service + // // await helpers.logout(); + // + // helpers.showErrorToast('Your session expired Please login agian'); + // } else + if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { + error = + parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - error = ''; for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { error = error + parsed["ValidationErrors"]["ValidationErrors"][i] ["Messages"][0] + diff --git a/lib/config/config.dart b/lib/config/config.dart index a4d5b96c..98b6e81d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -24,8 +24,7 @@ const PATIENT_GET_LIST_REFERAL_URL = "Services/Lists.svc/REST/GetList_STPReferralFrequency"; const PATIENT_GET_CLINIC_BY_PROJECT_URL = "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; -const PROJECT_GET_INFO = - "Services/DoctorApplication.svc/REST/GetProjectInfo"; +const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; const GET_PATIENT_VITAL_SIGN = @@ -92,21 +91,31 @@ const MEMBER_CHECK_ACTIVATION_CODE_NEW = const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp'; - const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_DASHBOARD = + 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI'; +const GET_SICKLEAVE_STATISTIC = + 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; +const ARRIVED_PATIENT_URL = + 'Services/DoctorApplication.svc/REST/PatientArrivalList​'; +const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; +const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; +const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; const GET_PATIENT_ARRIVAL_LIST = 'Services/DoctorApplication.svc/REST/PatientArrivalList'; - // SOAP const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; -const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; +const GET_MASTER_LOOKUP_LIST = + 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; +const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; +const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; var selectedPatientType = 1; @@ -118,7 +127,8 @@ var SERVICES_PATIANT = [ "GtMyReferredPatient", "GtMyDischargeReferralPatient", "GtMyTomorrowPatient", - "GtMyReferralPatient" + "GtMyReferralPatient", + "PatientArrivalList" ]; var SERVICES_PATIANT2 = [ "List_MyOutPatient", @@ -136,7 +146,8 @@ var SERVICES_PATIANT_HEADER = [ "Referred", "Referral Discharge", "Tomorrow", - "Referral" + "Referral", + "Arrived" ]; var SERVICES_PATIANT_HEADER_AR = [ "المريض الخارجي", @@ -145,7 +156,8 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول الي", "المريض المحال المعافى", "مريض الغد", - "المريض المحول مني" + "المريض المحول مني", + "وصل المريض" ]; //****************** @@ -167,5 +179,5 @@ const TIMER_MIN = 10; class AppGlobal { static var CONTEX; - static Color appPrimaryColor =Color(0xFFB9382C); + static Color appPrimaryColor = Color(0xFFB9382C); } diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 55dbf584..8b485195 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,4 +1,4 @@ -const Map> localizedValues = { +const Map> localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, @@ -202,7 +202,10 @@ const Map> localizedValues = { 'routine': {'en': 'Routine', 'ar': 'روتيني'}, 'send': {'en': 'Send', 'ar': 'ارسال'}, 'referralFrequency': {'en': 'Referral Frequency:', 'ar': 'تواتر الحالة:'}, - 'selectReferralFrequency': {'en': 'Select Referral Frequency:', 'ar': 'اختار تواتر الحالة:'}, + 'selectReferralFrequency': { + 'en': 'Select Referral Frequency:', + 'ar': 'اختار تواتر الحالة:' + }, 'clinicalDetailsAndRemarks': { 'en': 'Clinical Details and Remarks', 'ar': 'التفاصيل السرسرية والملاحظات' @@ -258,17 +261,21 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - 'replySuccessfully': { - 'en': 'Reply Successfully', - 'ar': 'تم الرد بنجاح' - }, + "sick-leaves": {"en": "Patient Sick Leave", "ar": "الاجازات المرضية"}, + "patient-sick": {"en": "Patient Sick", "ar": "المرضية"}, + "leave": {"en": "Leave", "ar": "غادر"}, + "submit": {"en": "Submit", "ar": "ارسال"}, + "doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"}, + "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, + "sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."}, + "sick-leave-days": {"en": "Sick leave days", "ar": "عدد ايام الاجازة."}, + 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, 'admissionNo': {'en': 'ADMISSION #: ', 'ar': 'قبول #:'}, @@ -276,13 +283,43 @@ const Map> localizedValues = { 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, - 'next': {'en': 'Next', 'ar': 'التالي'}, - 'healthRecordInformation': {'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي'}, + "prevoius-sickleave-issed": { + "en": "Total previous sick leave issued by the doctor", + "ar": "مجموع الإجازات المرضية السابقة التي أصدرها الطبيب" + }, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, - "empty-message": { - "en": "Please enter message", - "ar": "يرجى ادخال الموضوع" + 'no-sickleve-applied': { + 'en': "No sick leave applied", + 'ar': 'لم تطبق إجازة مرضية' + }, + 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, + 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, + 'add': {'en': "Add", 'ar': 'أضف'}, + 'approved': {'en': "Approved", 'ar': 'وافق'}, + 'extended': {'en': "Extended", 'ar': 'وسعوا'}, + 'pending': {'en': "Pending", 'ar': 'قيد الانتظار'}, + 'leave-start-date': {'en': "Leave start date", 'ar': 'تاريخ بدء المغادرة'}, + 'days-sick-leave': {'en': "DAYS OF SICK LEAVE", 'ar': 'أيام الإجازة المرضية'}, + 'extend': {'en': "Extend", 'ar': 'تمديد'}, + 'extend-sickleave': { + 'en': "EXTEND SICK LEAVE", + 'ar': 'قم بتمديد الإجازة المرضية' + }, + "empty-message": {"en": "Please enter Value", "ar": "يرجى ادخال القيمه"}, + "chiefComplaintLength": { + "en": "Chief Complaint length should be greater than 25", + "ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25" + }, + 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'}, + 'no-priscription-listed': { + 'en': 'No Prescription Listed', + 'ar': 'لا وصفة طبية مدرجة' + }, + 'next': {'en': 'Next', 'ar': 'التالي'}, + 'healthRecordInformation': { + 'en': 'HEALTH RECORD INFORMATION', + 'ar': 'معلومات السجل الصحي' }, 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, 'referredFrom': {'en': "Referred From", 'ar': 'محال من'}, @@ -290,7 +327,6 @@ const Map> localizedValues = { 'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'}, 'appointmentNo': {'en': "Appointment #:", 'ar': '# الموعد:'}, 'refer': {'en': "REFER", 'ar': 'إحالة'}, - 'approved': {'en': "Approved", 'ar': 'موافق عليه'}, 'rejected': {'en': "Rejected", 'ar': 'مرفوض'}, 'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'}, 'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'}, @@ -299,5 +335,19 @@ const Map> localizedValues = { 'summaryReport': {'en': "Summary Report", 'ar': 'تقرير موجز'}, 'accept': {'en': "ACCEPT", 'ar': 'قبول'}, 'reject': {'en': "REJECT", 'ar': 'رفض'}, - 'noAppointmentsErrorMsg': {'en': "There is no appointments for at this date", 'ar': 'لا توجد مواعيد في هذا التاريخ'}, + 'noAppointmentsErrorMsg': { + 'en': "There is no appointments for at this date", + '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': 'الطريقة'}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 7fd0eba2..e483c7d1 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -9,3 +9,4 @@ final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; final LIVE_CARE_PATIENT = 'livecare-patient-profile'; final LOGGED_IN_USER = 'loggedUser'; +final DASHBOARD_DATA = 'dashboard-data'; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 56645184..1a8c91a1 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,14 +1,13 @@ 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/service/base/base_service.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_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'base/lookup-service.dart'; class SOAPService extends LookupService { - Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, @@ -27,13 +26,38 @@ class SOAPService extends LookupService { } Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + hasError = false; await baseAppClient.post(POST_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: postAllergyRequestModel.toJson()); } + + Future postHistories( + PostHistoriesRequestModel postHistoriesRequestModel) async { + hasError = false; + await baseAppClient.post(POST_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postHistoriesRequestModel.toJson()); + } + + Future postChiefComplaint( + PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + hasError = false; + await baseAppClient.post(POST_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); + } } diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index 4cddb985..d2c4eb1f 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -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 ca794d91..9426c9fb 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'base_service.dart'; class LookupService extends BaseService { - List listOfAllergies = []; List get allergySeverityList => _allergySeverityList; @@ -26,20 +25,26 @@ class LookupService extends BaseService { List get historySurgicalList => _historySurgicalList; List _historySurgicalList = []; - List listOfPhysiotherapyGoals = []; + List listOfPhysiotherapyGoals = []; + + List get physicalExaminationList => _physicalExaminationList; + List _physicalExaminationList = []; + + // List listOfPhysiotherapyGoals = []; Future getMasterLookup(MasterKeysService masterKeys) async { + hasError = false; Map body = { "MasterInput": masterKeys.getMasterKeyService() }; await baseAppClient.post(GET_MASTER_LOOKUP_LIST, onSuccess: (dynamic response, int statusCode) { - setMasterLookupInCorrectArray( - response['MasterLookUpList']['entityList'], masterKeys); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + setMasterLookupInCorrectArray( + response['MasterLookUpList']['entityList'], masterKeys); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { @@ -47,61 +52,57 @@ class LookupService extends BaseService { case MasterKeysService.Allergies: listOfAllergies.clear(); entryList.forEach((v) { - listOfAllergies - .add(MasterKeyModel.fromJson(v)); + listOfAllergies.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistoryFamily: _historyFamilyList.clear(); entryList.forEach((v) { - _historyFamilyList - .add(MasterKeyModel.fromJson(v)); + _historyFamilyList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistoryMedical: _historyMedicalList.clear(); entryList.forEach((v) { - _historyMedicalList - .add(MasterKeyModel.fromJson(v)); + _historyMedicalList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistorySocial: historySocialList.clear(); entryList.forEach((v) { - historySocialList - .add(MasterKeyModel.fromJson(v)); + historySocialList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistorySports: _historySportList.clear(); entryList.forEach((v) { - _historySportList - .add(MasterKeyModel.fromJson(v)); - }); break; + _historySportList.add(MasterKeyModel.fromJson(v)); + }); + break; case MasterKeysService.HistorySurgical: _historySurgicalList.clear(); entryList.forEach((v) { - _historySurgicalList - .add(MasterKeyModel.fromJson(v)); + _historySurgicalList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.PhysicalExamination: - return 59; + _physicalExaminationList.clear(); + entryList.forEach((v) { + _physicalExaminationList.add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.AllergySeverity: _allergySeverityList.clear(); entryList.forEach((v) { - _allergySeverityList - .add(MasterKeyModel.fromJson(v)); + _allergySeverityList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.physiotherapyGoals: listOfPhysiotherapyGoals.clear(); entryList.forEach((v) { - listOfPhysiotherapyGoals - .add(MasterKeyModel.fromJson(v)); + listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v)); }); break; } } -} \ No newline at end of file +} diff --git a/lib/core/service/dasboard_service.dart b/lib/core/service/dasboard_service.dart new file mode 100644 index 00000000..5a66e9eb --- /dev/null +++ b/lib/core/service/dasboard_service.dart @@ -0,0 +1,31 @@ +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/dashboard/dashboard_model.dart'; + +class DashboardService extends BaseService { + List _dashboardItemsList = []; + List get dashboardItemsList => _dashboardItemsList; + + // DashboardModel _dashboard = DashboardModel(); + + Future getDashboard() async { + hasError = false; + await baseAppClient.post( + GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + _dashboardItemsList.clear(); + response['listDoctorDashboarKPI'].forEach((v) { + _dashboardItemsList.add(DashboardModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + // "VidaAuthTokenID": + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" + }, + ); + } +} diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 578aea88..d508fec6 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -1,5 +1,6 @@ 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'; @@ -45,21 +46,25 @@ class VitalSignsService extends BaseService{ ); } // Vit*/ - Future getPatientVitalSign(/*PatientArrivalEntity patientArrivalEntity*/) async { + Future getPatientVitalSign(PatientArrivalEntity patientArrivalEntity) async { hasError = false; Map body = Map(); - body['PatientMRN'] = 50377782; + 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']['entityList'] = null && (response['VitalSignsList']['entityList'] as List).length > 0){ - patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); + 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; + super.error = error.toString(); }, body: body, ); diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index 9aa52923..38e015cd 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -63,6 +63,10 @@ class PatientService extends BaseService { // TODO: replace var with model var _doctorsList = []; + var _arrivedList = []; + + get arrivedList => _arrivedList; + get doctorsList => _doctorsList; // TODO: replace var with model @@ -275,7 +279,7 @@ class PatientService extends BaseService { ); } - Future getPatientInsuranceApprovals(patient) async { + Future getPatientInsuranceApprovals(patient) async { hasError = false; await baseAppClient.post( @@ -292,7 +296,7 @@ class PatientService extends BaseService { ); } - Future getPatientProgressNote(patient) async { + Future getPatientProgressNote(patient) async { hasError = false; await baseAppClient.post( @@ -309,7 +313,6 @@ class PatientService extends BaseService { ); } - Future getClinicsList() async { hasError = false; @@ -327,7 +330,6 @@ class PatientService extends BaseService { ); } - Future getReferralFrequancyList() async { hasError = false; @@ -362,19 +364,19 @@ class PatientService extends BaseService { ); } - // TODO send the total model insted of each parameter - Future referToDoctor({String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + Future referToDoctor( + {String selectedDoctorID, + String selectedClinicID, + int admissionNo, + String extension, + String priority, + String frequency, + String referringDoctorRemarks, + int patientID, + int patientTypeID, + String roomID, + int projectID}) async { hasError = false; // TODO Change it to use it when we implement authentication user Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -408,4 +410,21 @@ class PatientService extends BaseService { body: _referToDoctorRequest.toJson(), ); } + + Future getArrivedList() async { + hasError = false; + + await baseAppClient.post( + ARRIVED_PATIENT_URL, + onSuccess: (dynamic response, int statusCode) { + _arrivedList = []; + _arrivedList = response['"patientArrivalList": ']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _doctorsByClinicIdRequest.toJson(), + ); + } } diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart new file mode 100644 index 00000000..70d9a3e4 --- /dev/null +++ b/lib/core/service/sickleave_service.dart @@ -0,0 +1,93 @@ +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/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +// import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; + +class SickLeaveService extends BaseService { + Map get sickLeavestatisitics => _statistics; + Map _statistics = {}; + + List get getAllSickLeave => _getAllsickLeave; + List _getAllsickLeave = []; + Future getStatistics(appoNo, patientMRN) async { + hasError = false; + await baseAppClient.post( + GET_SICKLEAVE_STATISTIC, + onSuccess: (dynamic response, int statusCode) { + print(response); + _statistics = {}; + _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"PatientMRN": patientMRN, "AppointmentNo": appoNo}, + ); + } + + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + addSickLeaveRequest.appointmentNo = '2016054661'; + addSickLeaveRequest.patientMRN = '3120746'; + hasError = false; + await baseAppClient.post( + ADD_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + print(response); + // _statistics = {}; + // _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: addSickLeaveRequest.toJson(), + ); + } + + Future extendSickLeave(GetAllSickLeaveResponse request) async { + var extendSickLeaveRequest = ExtendSickLeaveRequest(); + extendSickLeaveRequest.patientMRN = + request.patientMRN.toString(); //'3120746'; + extendSickLeaveRequest.previousRequestNo = request.requestNo.toString(); + extendSickLeaveRequest.noOfDays = request.noOfDays.toString(); + extendSickLeaveRequest.remarks = request.remarks; + hasError = false; + await baseAppClient.post( + EXTEND_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + print(response); + // _statistics = {}; + // _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: extendSickLeaveRequest.toJson(), + ); + } + + Future getSickLeave() async { + hasError = false; + await baseAppClient.post( + GET_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getAllsickLeave.clear(); + response['SickLeavesList']['entityList'].forEach((v) { + _getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'PatientMRN': 3120772}, + ); + } +} diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 608b2e3d..3ff33389 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,8 @@ 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_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -27,6 +29,7 @@ class SOAPViewModel extends BaseViewModel { List get historySocialList => _SOAPService.historySocialList; List get historySurgicalList => _SOAPService.historySurgicalList; List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; + List get physicalExaminationList => _SOAPService.physicalExaminationList; @@ -60,5 +63,25 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postHistories(postHistoriesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index 120642bf..47ffe730 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -19,17 +19,16 @@ class AuthViewModel with ChangeNotifier { bool isLoading = true; DoctorProfileModel doctorProfile; BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel){ + setDoctorProfile(DoctorProfileModel profileModel) { doctorProfile = profileModel; notifyListeners(); } - AuthViewModel() { getUserAuthentication(); } - getUserAuthentication() async { + getUserAuthentication() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -195,7 +194,8 @@ class AuthViewModel with ChangeNotifier { await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; - doctorProfile = DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); + doctorProfile = + DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription']; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart new file mode 100644 index 00000000..9eb3c0fc --- /dev/null +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -0,0 +1,21 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class DashboardViewModel extends BaseViewModel { + DashboardService _dashboardService = locator(); + get dashboardItemsList => _dashboardService.dashboardItemsList; + + Future getDashboard() async { + setState(ViewState.Busy); + await _dashboardService.getDashboard(); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } 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 100% rename from lib/core/viewModel/patient-doctor-referral-viewModel.dart rename to lib/core/viewModel/patient-referral-viewmodel.dart diff --git a/lib/core/viewModel/patient-vital-sign-viewModel.dart b/lib/core/viewModel/patient-vital-sign-viewModel.dart deleted file mode 100644 index 30f979f3..00000000 --- a/lib/core/viewModel/patient-vital-sign-viewModel.dart +++ /dev/null @@ -1,31 +0,0 @@ -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/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(); - - VitalSignData get patientVitalSigns => - _vitalSignService.patientVitalSigns; - - Future getPatientVitalSign() async { - setState(ViewState.Busy); - await _vitalSignService.getPatientVitalSign(); - if (_vitalSignService.hasError) { - error = _vitalSignService.error; - setState(ViewState.Error); - } else { - if(patientVitalSigns == null) { - _vitalSignService.patientVitalSigns = VitalSignData( - appointmentNo: 2016053265, bloodPressureCuffLocation: 0, bloodPressureCuffSize: 0, bloodPressureHigher: 38, - ); - } - setState(ViewState.Idle); - } - } - -} \ No newline at end of file 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..fab050ac --- /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; + _vitalSignService.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/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index e03e0853..a1221266 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -248,4 +248,14 @@ class PatientViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getArrivedList() async { + setState(ViewState.Busy); + await _patientService.getArrivedList(); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart new file mode 100644 index 00000000..a11d43ec --- /dev/null +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -0,0 +1,54 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class SickLeaveViewModel extends BaseViewModel { + SickLeaveService _sickLeaveService = locator(); + get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; + get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.addSickLeave(addSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future preSickLeaveStatistics(appoNo, patientMRN) async { + setState(ViewState.Busy); + await _sickLeaveService.getStatistics(appoNo, patientMRN); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getSickLeave() async { + setState(ViewState.Busy); + await _sickLeaveService.getSickLeave(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 2d181f78..3588a0f8 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,5 +1,9 @@ +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/patient_service.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; import 'core/service/SOAP_service.dart'; @@ -13,8 +17,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-vital-sign-viewModel.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'; @@ -30,6 +34,8 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => DashboardService()); + locator.registerLazySingleton(() => SickLeaveService()); locator.registerLazySingleton(() => SOAPService()); locator.registerLazySingleton(() => PatientReferralService()); locator.registerLazySingleton(() => VitalSignsService()); @@ -41,6 +47,8 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => DashboardViewModel()); + locator.registerFactory(() => SickLeaveViewModel()); locator.registerFactory(() => SOAPViewModel()); locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => VitalSignsViewModel()); diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 189535ce..d8db7945 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -10,6 +10,7 @@ const PATIENT_TYPE = const [ }, {"text": "Tomorrow Patient", "text_ar": "مريض الغد", "val": "5"}, {"text": "Referral", "text_ar": "المريض المحول مني", "val": "6"}, + {"text": "Arrived", "text_ar": "وصل", "val": "7"}, ]; const LOCATIONS = const [ diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart new file mode 100644 index 00000000..3b6685c8 --- /dev/null +++ b/lib/models/SOAP/my_selected_examination.dart @@ -0,0 +1,33 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + + MySelectedExamination( + {this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false}); + + MySelectedExamination.fromJson(Map json) { + + selectedExamination = json['selectedExamination'] != null + ? new MasterKeyModel.fromJson(json['selectedExamination']) + : null; + remark = json['remark']; + remark = json['isNormal']; + remark = json['isAbnormal']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedExamination != null) { + data['selectedExamination'] = this.selectedExamination.toJson(); + } + data['remark'] = this.remark; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + return data; + } +} diff --git a/lib/models/SOAP/post_chief_complaint_request_model.dart b/lib/models/SOAP/post_chief_complaint_request_model.dart new file mode 100644 index 00000000..bedf2978 --- /dev/null +++ b/lib/models/SOAP/post_chief_complaint_request_model.dart @@ -0,0 +1,48 @@ +class PostChiefComplaintRequestModel { + int appointmentNo; + int episodeID; + int patientMRN; + String chiefComplaint; + String hopi; + String currentMedication; + bool ispregnant; + bool isLactation; + int numberOfWeeks; + + PostChiefComplaintRequestModel( + {this.appointmentNo, + this.episodeID, + this.patientMRN, + this.chiefComplaint, + this.hopi, + this.currentMedication, + this.ispregnant, + this.isLactation, + this.numberOfWeeks}); + + PostChiefComplaintRequestModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + patientMRN = json['PatientMRN']; + chiefComplaint = json['chiefComplaint']; + hopi = json['Hopi']; + currentMedication = json['CurrentMedication']; + ispregnant = json['ispregnant']; + isLactation = json['isLactation']; + numberOfWeeks = json['numberOfWeeks']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['PatientMRN'] = this.patientMRN; + data['chiefComplaint'] = this.chiefComplaint; + data['Hopi'] = this.hopi; + data['CurrentMedication'] = this.currentMedication; + data['ispregnant'] = this.ispregnant; + data['isLactation'] = this.isLactation; + data['numberOfWeeks'] = this.numberOfWeeks; + return data; + } +} diff --git a/lib/models/SOAP/post_histories_request_model.dart b/lib/models/SOAP/post_histories_request_model.dart new file mode 100644 index 00000000..baa428fd --- /dev/null +++ b/lib/models/SOAP/post_histories_request_model.dart @@ -0,0 +1,64 @@ +class PostHistoriesRequestModel { + List listMedicalHistoryVM; + + PostHistoriesRequestModel({this.listMedicalHistoryVM}); + + PostHistoriesRequestModel.fromJson(Map json) { + if (json['listMedicalHistoryVM'] != null) { + listMedicalHistoryVM = new List(); + json['listMedicalHistoryVM'].forEach((v) { + listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listMedicalHistoryVM != null) { + data['listMedicalHistoryVM'] = + this.listMedicalHistoryVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListMedicalHistoryVM { + int patientMRN; + int historyType; + int historyId; + int episodeId; + int appointmentNo; + bool isChecked; + String remarks; + + ListMedicalHistoryVM( + {this.patientMRN, + this.historyType, + this.historyId, + this.episodeId, + this.appointmentNo, + this.isChecked, + this.remarks}); + + ListMedicalHistoryVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + historyType = json['historyType']; + historyId = json['historyId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + isChecked = json['isChecked']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['historyType'] = this.historyType; + data['historyId'] = this.historyId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['isChecked'] = this.isChecked; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart new file mode 100644 index 00000000..f9f23897 --- /dev/null +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -0,0 +1,99 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class PostPhysicalExamRequestModel { + List listHisProgNotePhysicalVM; + + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + + PostPhysicalExamRequestModel.fromJson(Map json) { + if (json['listHisProgNotePhysicalVM'] != null) { + listHisProgNotePhysicalVM = new List(); + json['listHisProgNotePhysicalVM'].forEach((v) { + listHisProgNotePhysicalVM + .add(new ListHisProgNotePhysicalVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePhysicalVM != null) { + data['listHisProgNotePhysicalVM'] = + this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListHisProgNotePhysicalVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + bool notExamined; + MasterKeyModel masterDescription; + + ListHisProgNotePhysicalVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.notExamined, + this.masterDescription}); + + ListHisProgNotePhysicalVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + notExamined = json['notExamined']; + masterDescription = json['masterDescription'] != null + ? new MasterKeyModel.fromJson(json['masterDescription']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['notExamined'] = this.notExamined; + if (this.masterDescription != null) { + data['masterDescription'] = this.masterDescription.toJson(); + } + return data; + } +} \ No newline at end of file diff --git a/lib/models/dashboard/dashboard_model.dart b/lib/models/dashboard/dashboard_model.dart new file mode 100644 index 00000000..0e03e899 --- /dev/null +++ b/lib/models/dashboard/dashboard_model.dart @@ -0,0 +1,70 @@ +class DashboardModel { + String kPIName; + int displaySequence; + List summaryoptions; + + DashboardModel({this.kPIName, this.displaySequence, this.summaryoptions}); + + DashboardModel.fromJson(Map json) { + kPIName = json['KPIName']; + displaySequence = json['displaySequence']; + if (json['summaryoptions'] != null) { + summaryoptions = new List(); + json['summaryoptions'].forEach((v) { + summaryoptions.add(new Summaryoptions.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['KPIName'] = this.kPIName; + data['displaySequence'] = this.displaySequence; + if (this.summaryoptions != null) { + data['summaryoptions'] = + this.summaryoptions.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Summaryoptions { + String kPIParameter; + String captionColor; + bool isCaptionBold; + bool isValueBold; + int order; + int value; + String valueColor; + + Summaryoptions( + {this.kPIParameter, + this.captionColor, + this.isCaptionBold, + this.isValueBold, + this.order, + this.value, + this.valueColor}); + + Summaryoptions.fromJson(Map json) { + kPIParameter = json['KPIParameter']; + captionColor = json['captionColor']; + isCaptionBold = json['isCaptionBold']; + isValueBold = json['isValueBold']; + order = json['order']; + value = json['value']; + valueColor = json['valueColor']; + } + + Map toJson() { + final Map data = new Map(); + data['KPIParameter'] = this.kPIParameter; + data['captionColor'] = this.captionColor; + data['isCaptionBold'] = this.isCaptionBold; + data['isValueBold'] = this.isValueBold; + data['order'] = this.order; + data['value'] = this.value; + data['valueColor'] = this.valueColor; + return data; + } +} diff --git a/lib/models/sickleave/add_sickleave_request.dart b/lib/models/sickleave/add_sickleave_request.dart new file mode 100644 index 00000000..d398153b --- /dev/null +++ b/lib/models/sickleave/add_sickleave_request.dart @@ -0,0 +1,32 @@ +class AddSickLeaveRequest { + String patientMRN; + String appointmentNo; + String startDate; + String noOfDays; + String remarks; + + AddSickLeaveRequest( + {this.patientMRN, + this.appointmentNo, + this.startDate, + this.noOfDays, + this.remarks}); + + AddSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + startDate = json['StartDate']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['StartDate'] = this.startDate; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/extend_sick_leave_request.dart b/lib/models/sickleave/extend_sick_leave_request.dart new file mode 100644 index 00000000..8b61eb90 --- /dev/null +++ b/lib/models/sickleave/extend_sick_leave_request.dart @@ -0,0 +1,25 @@ +class ExtendSickLeaveRequest { + String patientMRN; + String previousRequestNo; + String noOfDays; + String remarks; + + ExtendSickLeaveRequest( + {this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks}); + + ExtendSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + previousRequestNo = json['PreviousRequestNo']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['PreviousRequestNo'] = this.previousRequestNo; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/get_all_sickleave_response.dart b/lib/models/sickleave/get_all_sickleave_response.dart new file mode 100644 index 00000000..f3fc8032 --- /dev/null +++ b/lib/models/sickleave/get_all_sickleave_response.dart @@ -0,0 +1,44 @@ +class GetAllSickLeaveResponse { + int appointmentNo; + bool isExtendedLeave; + int noOfDays; + int patientMRN; + String remarks; + int requestNo; + String startDate; + int status; + + GetAllSickLeaveResponse( + {this.appointmentNo, + this.isExtendedLeave, + this.noOfDays, + this.patientMRN, + this.remarks, + this.requestNo, + this.startDate, + this.status}); + + GetAllSickLeaveResponse.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + isExtendedLeave = json['isExtendedLeave']; + noOfDays = json['noOfDays']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + requestNo = json['requestNo']; + startDate = json['startDate']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['isExtendedLeave'] = this.isExtendedLeave; + data['noOfDays'] = this.noOfDays; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + data['requestNo'] = this.requestNo; + data['startDate'] = this.startDate; + data['status'] = this.status; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 257db6fc..4f2367e2 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -7,6 +7,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/add_SOAP_index.dart'; import './screens/QR_reader_screen.dart'; @@ -40,7 +42,7 @@ import 'screens/doctor/doctor_reply_screen.dart'; 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/patients/vital-signs-screen.dart'; +import 'screens/patients/profile/vital_sign/vital-signs-screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -75,14 +77,16 @@ const String PATIENT_ORDERS = 'patients/patient_orders'; 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 CREATE_EPISODE = 'patients/create-episode'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; // const String VIDEO_CALL = 'video-call'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; +const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; +const String ADD_SICKLEAVE = 'add-sickleave'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -116,11 +120,14 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), - CREATE_EPISODE:(_)=>AddSOAPIndex(), + CREATE_EPISODE: (_) => AddSOAPIndex(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), + // LIVECARE_END_DIALOG: (_) => EndCallDialogBox(), + PATIENT_SICKLEAVE: (_) => SickLeaveScreen(), + ADD_SICKLEAVE: (_) => AddSickLeavScreen(), // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index ddacb6bc..b6bbc6cf 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -7,6 +9,7 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -18,7 +21,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:provider/provider.dart'; - +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import '../routes.dart'; import '../widgets/shared/app_texts_widget.dart'; import 'doctor/doctor_reply_screen.dart'; @@ -47,7 +50,8 @@ class _DashboardScreenState extends State { ProjectViewModel projectsProvider; var _isInit = true; DoctorProfileModel profile; - + bool isExpanded = false; + String isInpatient = ""; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -72,11 +76,11 @@ class _DashboardScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } - return SafeArea( - bottom: true, - child: AppScaffold( + return BaseView( + onModelReady: (model) => model.getDashboard(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, isShowAppBar: false, - isLoading: isLoading, body: ListView(children: [ Column( children: [ @@ -92,43 +96,86 @@ class _DashboardScreenState extends State { actionList: projectsProvider.doctorClinicsList); }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, 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, + Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).welcome, + fontSize: + SizeConfig.textMultiplier * 1.7, + color: Colors.white, + ) + ], + ), + SizedBox( + height: 4, + ), 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, - )), + 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, + )), + ), + ], + ), + ]), ), ], ), @@ -137,179 +184,437 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: 90, + height: this.isExpanded ? 150 : 110, ), ], ), Positioned( - right: 9.0, - left: 9, - bottom: 19, - child: Container( - decoration: BoxDecoration( - color: HexColor("#DED8CF"), - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - margin: EdgeInsets.only(left: 10, right: 10), - height: 140, - width: double.infinity, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Divider(), - Padding( - padding: const EdgeInsets.only( - top: 8.0, bottom: 8, right: 40, left: 8), - child: CircularPercentIndicator( - radius: 100, - animation: true, - animationDuration: 1200, - lineWidth: 7.0, - percent: .75, - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - "38", - fontSize: SizeConfig.textMultiplier * 3.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - AppText( - TranslationBase.of(context).outPatients, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.4, - color: HexColor('#5D4C35'), - ), - ], + right: 9.0, + left: 9, + bottom: 15, + child: ExpandableCardContainer( + expandedChild: Container( + margin: EdgeInsets.only(left: 10, right: 10), + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.22 + : MediaQuery.of(context).size.height * 0.25, + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DashboardItem( + onTap: () { + setState(() { + this.isExpanded = false; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[0] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[0] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 24, + ), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[0] + .kPIParameter + : model + .dashboardItemsList[ + 1] + .summaryoptions[0] + .kPIParameter + : "", + //'My Admitted Patient', + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[1] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28, + ), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .kPIParameter + : model + .dashboardItemsList[ + 1] + .summaryoptions[1] + .kPIParameter + : "", + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[2] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[2] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + )) + ], + ), + Row( + children: [ + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[3] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[3] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[3] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[3] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[ + 4] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[ + 4] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[ + 4] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[ + 4] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + ), + ), + Expanded( + child: Container(), + ) + ], + ) + ], + )), + imageName: '5.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.9, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.22 + : MediaQuery.of(context).size.height * 0.25, ), - circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: Colors.blueGrey[100], - progressColor: HexColor('#B8382C'), - ), + ], ), - Container( - child: Table( - defaultColumnWidth: FixedColumnWidth( - MediaQuery.of(context).size.width / 5), -// border: TableBorder.all( -// color: Colors.black26, -// width: 1, -// style: BorderStyle.solid), - border: TableBorder.symmetric( - inside: BorderSide( - width: 0.5, - color: HexColor('#5D4C35'), - ), - ), - children: [ - TableRow( - children: [ - TableCell( - child: Center( - child: Column( + ), + collapsedChild: Container( + margin: EdgeInsets.only(left: 10, right: 10), + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DashboardItem( + onTap: () { + setState(() { + this.isExpanded = true; + this.isInpatient = 'in'; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).arrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "23", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[0]) + : "", fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, + SizeConfig.textMultiplier * 6, + color: Colors.white, ), + Flexible( + child: AppText( + TranslationBase.of(context).inPatient, + color: Colors.white, + textOverflow: TextOverflow.ellipsis, + )), ], ), - )), - TableCell( - child: Column( + Padding( + padding: EdgeInsets.all(5), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Icon( + DoctorApp.in_patient_white, + size: 35, + color: Colors.white, + ) + ], + )) + ], + ), + ), + imageName: '4.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + ), + DashboardItem( + onTap: () { + setState(() { + isExpanded = true; + this.isInpatient = 'out'; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).er, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "03", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[1]) + : "", fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, + SizeConfig.textMultiplier * 6, + color: Colors.white, ), + Flexible( + child: AppText( + TranslationBase.of(context) + .outPatients, + color: Colors.white, + textOverflow: TextOverflow.ellipsis, + )), ], ), - ), - ], -// - ), - TableRow(children: [ - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).notArrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "15", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - ], - ), - ), - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).walkIn, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "04", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - ], - ), + Padding( + padding: EdgeInsets.all(5), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Icon( + DoctorApp.out_patient, + size: 35, + color: Colors.white, + ) + ], + )) + ], ), - ]), - ], - ), + ), + imageName: '5.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + ), + ], ), - Divider(), - ], - ), - ), - ) + ), + isExpanded: isExpanded, + )) ]), FractionallySizedBox( widthFactor: 0.90, @@ -335,16 +640,21 @@ class _DashboardScreenState extends State { ), ), Container( - margin: EdgeInsets.only(bottom: 10), + // margin: EdgeInsets.only(bottom: 10), child: Column( children: [ AppText( - "08", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[7]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), AppText( - TranslationBase.of(context).labResult, + TranslationBase.of(context) + .targetPatient, + textAlign: TextAlign.center, color: Colors.white, ) ], @@ -372,7 +682,10 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - "10", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[6]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), @@ -405,7 +718,10 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - "05", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[2]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), @@ -426,99 +742,6 @@ class _DashboardScreenState extends State { SizedBox( height: 15, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.in_patient_white, - size: 40, - color: Colors.white, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "14", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).inPatient, - color: Colors.white, - ) - ], - ) - ], - ), - ), - imageName: '4.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery.of(context).size.width * 0.44, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.13 - : MediaQuery.of(context).size.height * 0.25, - ), - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.operations, - size: 40, - color: Colors.white, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "07", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).operations, - color: Colors.white, - ) - ], - ) - ], - ), - ), - imageName: '5.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery.of(context).size.width * 0.44, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.13 - : MediaQuery.of(context).size.height * 0.25, - ), - ], - ), - SizedBox( - height: 15, - ), Row( children: [ AppText( @@ -834,6 +1057,13 @@ class _DashboardScreenState extends State { this.isLoading = val; }); } + + getPatientCount(DashboardModel inPatientCount) { + int value = 0; + inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + + return value.toString(); + } } // TODO Move to it file @@ -895,3 +1125,28 @@ class DashboardItem extends StatelessWidget { ); } } + +class ExpandableCardContainer extends StatefulWidget { + final bool isExpanded; + final Widget collapsedChild; + final Widget expandedChild; + + const ExpandableCardContainer( + {Key key, this.isExpanded, this.collapsedChild, this.expandedChild}) + : super(key: key); + + @override + _ExpandableCardContainerState createState() => + _ExpandableCardContainerState(); +} + +class _ExpandableCardContainerState extends State { + @override + Widget build(BuildContext context) { + return new AnimatedContainer( + duration: new Duration(milliseconds: 1000), + curve: Curves.easeInOut, + child: widget.isExpanded ? widget.expandedChild : widget.collapsedChild, + ); + } +} diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index aa2e1fc7..b39493cf 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -246,24 +246,13 @@ class _PatientsScreenState extends State { @override Widget build(BuildContext context) { _locations = [ - TranslationBase - .of(context) - .all, - TranslationBase - .of(context) - .today, - TranslationBase - .of(context) - .tomorrow, - TranslationBase - .of(context) - .nextWeek, + TranslationBase.of(context).all, + TranslationBase.of(context).today, + TranslationBase.of(context).tomorrow, + TranslationBase.of(context).nextWeek, ]; projectsProvider = Provider.of(context); - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patientSearchForm']; @@ -301,397 +290,394 @@ class _PatientsScreenState extends State { }); }); }, - builder: (_, model, w) => - AppScaffold( - appBarTitle: patientTypeTitle, - body: _isLoading - ? DrAppCircularProgressIndeicator() - : _isError + builder: (_, model, w) => AppScaffold( + appBarTitle: patientTypeTitle, + body: _isLoading + ? DrAppCircularProgressIndeicator() + : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .youDontHaveAnyPatient) - : Container( - child: ListView( - scrollDirection: Axis.vertical, - children: [ - Container( - child: lItems == null - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Center( - child: Padding( - padding: const EdgeInsets.fromLTRB( - 0, 0, 0, 0), //250 - child: - DrAppCircularProgressIndeicator(), - )), - ), - ], - ) - : Column( - children: [ - Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context) - .size - .height * - 0.03), - child: SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient" - ? _locationBar(context) - : Container(), - ), - SizedBox(height: 18.5), - Container( - width: SizeConfig.screenWidth * 0.9, - height: SizeConfig.screenHeight * 0.05, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, - TranslationBase.of(context) - .searchPatient), + ? DrAppEmbeddedError( + error: + TranslationBase.of(context).youDontHaveAnyPatient) + : Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: lItems == null + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Center( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 0, 0, 0, 0), //250 + child: + DrAppCircularProgressIndeicator(), + )), ), - ), - SizedBox( - height: 10.0, - ), - Divider( - thickness: 0.8, - color: Color(0xffCCCCCC), - ), - Container( - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: - BorderRadius.circular(20)), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - child: (responseModelList.length > 0) - ? Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: responseModelList.map( - (PatiantInformtion item) { - return Container( - decoration: - myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Padding( - padding: EdgeInsets - .only( - left: - 12.0), - child: - Container( - decoration: - BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO( - 0, - 0, - 0, - 0.08), - offset: Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular(35.0)), - color: Color( - 0xffCCCCCC), - ), - width: 70, - height: 70, - child: Icon( - item.genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 70, - color: Colors - .white, + ], + ) + : Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context) + .size + .height * + 0.03), + child: SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient" + ? _locationBar(context) + : Container(), + ), + SizedBox(height: 18.5), + Container( + width: SizeConfig.screenWidth * 0.9, + height: + SizeConfig.screenHeight * 0.05, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: buildInputDecoration( + context, + TranslationBase.of(context) + .searchPatient), + ), + ), + SizedBox( + height: 10.0, + ), + Divider( + thickness: 0.8, + color: Color(0xffCCCCCC), + ), + Container( + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: + BorderRadius.circular(20)), + margin: + EdgeInsets.fromLTRB(0, 0, 0, 0), + child: (responseModelList.length > 0) + ? Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: responseModelList + .map((PatiantInformtion + item) { + return Container( + decoration: + myBoxDecoration(), + child: InkWell( + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: < + Widget>[ + Padding( + padding: EdgeInsets + .only( + left: + 12.0), + child: + Container( + decoration: + BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color.fromRGBO( + 0, + 0, + 0, + 0.08), + offset: Offset(0.0, + 5.0), + blurRadius: + 16.0) + ], + borderRadius: + BorderRadius.all( + Radius.circular(35.0)), + color: Color( + 0xffCCCCCC), + ), + width: 70, + height: 70, + child: Icon( + item.genderDescription == + "Male" + ? DoctorApp + .male + : DoctorApp + .female_icon, + size: 70, + color: Colors + .white, + ), ), ), - ), - ], - ), + ], + ), - SizedBox( - width: 10, - ), + SizedBox( + width: 10, + ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Column( - children: [ - SizedBox( - height: - 10.0, - ), - Padding( - padding: EdgeInsets.symmetric( - vertical: - 5.5, - horizontal: - 22.5), - child: - AppText( - item.firstName + - " " + - item.lastName, - fontSize: - 2.0 * - SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Column( + children: [ + SizedBox( + height: + 10.0, ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Wrap( - children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: + 5.5, + horizontal: + 22.5), + child: AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.patientId.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - AppText( - 'NATIONALITY: ' + - item.nationalityName.toString(), + item.firstName + + " " + + item.lastName, fontSize: - 1.8 * SizeConfig.textMultiplier, + 2.0 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, ), - SizedBox( - height: - 15.5, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: < + Widget>[ + Wrap( + children: [ + AppText( + TranslationBase.of(context).fileNo, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.patientId.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + AppText( + 'NATIONALITY: ' + + item.nationalityName.toString(), + fontSize: + 1.8 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: + 15.5, + ), + SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, + SizedBox( + width: 3.5, ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), - SizedBox( - height: 0.5, - ) - ], - ) - : SizedBox( - height: 5, + SizedBox( + height: 0.5, + ) + ], + ) + : SizedBox( + height: 5, + ), + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + // mainAxisAlignment: + // MainAxisAlignment + // .spaceBetween, + children: < + Widget>[ + SizedBox( + height: + 0.5, + ), + SizedBox( + height: + 0, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).age2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, ), - ], - ), - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).age2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.age.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), + AppText( + item.age.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).gender2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.gender.toString() == '1' ? 'Male' : 'Female', + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 8, + ), + SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, + SizedBox( + width: 3.5, ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], - ), - ], - ), - ], + SizedBox( + height: 25.5, + ), + ], + ) + : SizedBox( + height: 15, + ), + ], + ), + ], + ), + ], + ), ), - ), - // Divider(color: Colors.grey) - ], + // Divider(color: Colors.grey) + ], + ), + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item + }); + }, ), - onTap: () { - Navigator.of(context) - .pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": item - }); - }, - ), - ); - }).toList(), - ) - : Center( - child: DrAppEmbeddedError( - error: TranslationBase.of( - context) - .youDontHaveAnyPatient), + ); + }).toList(), + ) + : Center( + child: DrAppEmbeddedError( + error: TranslationBase.of( + context) + .youDontHaveAnyPatient), + ), ), - ), - ], - ), - ) - ], - ), - ), - ),); + ], + ), + ) + ], + ), + ), + ), + ); } InputDecoration buildInputDecoration(BuildContext context, hint) { @@ -761,7 +747,6 @@ class _PatientsScreenState extends State { ), ), onTap: () { - filterBooking(item.toString()); setState(() { 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..5f38f190 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'; 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 2ab7cc18..c3c4096b 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,5 +1,5 @@ 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/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'; @@ -18,7 +18,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(); @@ -360,8 +360,7 @@ class _PatientMakeReferralScreenState extends State { ); if (picked != null && picked != appointmentDate) { appointmentDate = picked; - model - .getPatientArrivalList(DateUtils.convertStringToDateFormat( + model.getPatientArrivalList(DateUtils.convertStringToDateFormat( appointmentDate.toString(), "yyyy-MM-dd")) .then((_) { if (model.patientArrivalList != null && 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..9aa14cac --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -0,0 +1,390 @@ +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: 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, + ), + TemperatureWidget(model.patientVitalSigns), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} + +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 * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + 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 * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + 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 * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.temperatureCelciusMethod}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 32, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} diff --git a/lib/screens/patients/vital-signs-screen.dart b/lib/screens/patients/vital-signs-screen.dart deleted file mode 100644 index 6aeb5b3e..00000000 --- a/lib/screens/patients/vital-signs-screen.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:doctor_app_flutter/models/patient/patiant_info_model.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 Container(); - } -} diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart new file mode 100644 index 00000000..37bf9454 --- /dev/null +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -0,0 +1,192 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AddSickLeavScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getSickLeave(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: model.getAllSIckLeave.length > 0 + ? SingleChildScrollView( + child: Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( + context) + .approved + : item.status == 2 + ? TranslationBase + .of(context) + .extended + : TranslationBase + .of(context) + .pending, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.green + : Colors.yellow[800], + ), + Row( + children: [ + AppText( + TranslationBase.of( + context) + .leaveStartDate + + ' ', + fontWeight: + FontWeight.bold, + ), + Flexible( + child: Text( + item.startDate, + overflow: + TextOverflow.ellipsis, + )) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of( + context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks, + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + (item.status == 1 || item.status == 2) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.open_in_full, + size: 40, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + openSickLeave(context, true, + extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ), + ) + : new Builder(builder: (context) { + return Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: Border.all( + color: HexColor('#B8382C'), width: 4), + borderRadius: + BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noSickLeaveApplied, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )); + }), + )); + } + + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { + showModalBottomSheet( + context: context, + builder: (context) { + return new Container( + child: SickLeaveScreen( + appointmentNo: extendedData.appointmentNo, + patientMRN: extendedData.patientMRN, + isExtended: isExtend, + extendedData: extendedData, + )); + }); + } +} diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart new file mode 100644 index 00000000..026b7c19 --- /dev/null +++ b/lib/screens/sick-leave/sick_leave.dart @@ -0,0 +1,379 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/text_validator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; + +Helpers helpers = Helpers(); + +class SickLeaveScreen extends StatefulWidget { + final bool isExtended; + final GetAllSickLeaveResponse extendedData; + final appointmentNo; + final patientMRN; + SickLeaveScreen( + {this.appointmentNo, + this.patientMRN, + this.isExtended = false, + this.extendedData}); + @override + _SickLeaveScreenState createState() => _SickLeaveScreenState(); +} + +class _SickLeaveScreenState extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + String _selectedClinic; + Map profile = {}; + AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); + void _presentDatePicker(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2019), + lastDate: DateTime.now(), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + // var selectedDate = DateFormat.yMd().format(pickedDate); + final df = new DateFormat('yyyy-MM-dd'); + addSickLeave.startDate = df.format(pickedDate); + + _toDateController.text = addSickLeave.startDate; + //addSickLeave.startDate = selectedDate; + }); + }); + } + + @override + void initState() { + getProfile(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => model2.preSickLeaveStatistics( + widget.appointmentNo, widget.patientMRN), + builder: (_, model2, w) => AppScaffold( + baseViewModel: model2, + isShowAppBar: false, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + Padding( + child: AppText( + widget.isExtended == true + ? TranslationBase.of(context) + .extendSickLeave + : TranslationBase.of(context) + .addSickLeave, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10)), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + borderColor: Colors.white, + onChanged: (value) { + addSickLeave.noOfDays = value; + }, + hintText: widget.extendedData != null + ? widget.extendedData.noOfDays + .toString() + : TranslationBase.of(context) + .sickLeaveDays, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ]), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // AppText( + // TranslationBase.of(context).sickLeaveDate, + // fontSize: 10, + // ), + AppTextFormField( + hintText: widget.extendedData != null + ? widget.extendedData.startDate + : TranslationBase.of(context) + .sickLeaveDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + addSickLeave.startDate = value; + }), + ], + )), + Container( + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // AppText( + // TranslationBase.of(context).clinicName, + // fontSize: 10, + // ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + isExpanded: true, + value: getClinicName( + model) ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => + {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: + item.toString(), + child: Text( + item, + textAlign: + TextAlign.end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'] != + null + ? Padding( + child: AppText( + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'], + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ) + : SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // AppText( + // TranslationBase.of(context).doctorName, + // fontSize: 10, + // ), + new IgnorePointer( + ignoring: true, + child: AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS)) + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // AppText( + // TranslationBase.of(context).remarks, + // fontSize: 10, + // ), + AppTextFormField( + borderColor: Colors.white, + hintText: widget.extendedData != null + ? widget.extendedData.remarks + : TranslationBase.of(context).remarks, + onChanged: (value) { + addSickLeave.remarks = value; + }, + validator: (value) { + // return TextValidator().validateName(value); + }, + inputFormatter: ONLY_LETTERS) + ], + ), + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isExtended == true + ? TranslationBase.of(context).extend + : TranslationBase.of(context).add, + onPressed: () { + if (widget.isExtended) { + model2 + .extendSickLeave( + widget.extendedData) + .then((value) => (value) { + print(value); + }); + } else { + model2 + .addSickLeave(addSickLeave) + .then((value) => print(value)); + } + }, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], + ), + ), + ), + ), + ))); + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; + }); + } + + getClinicName(model) { + var clinicInfo = model.clinicsList + .where((i) => i['ClinicID'] == this.profile['ClinicID']) + .toList(); + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; + } +} 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 c6ded448..fbd8cb80 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -33,7 +33,8 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode]; + String get replySuccessfully => + localizedValues['replySuccessfully'][locale.languageCode]; String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; @@ -79,8 +80,11 @@ class TranslationBase { localizedValues['patientServices'][locale.languageCode]; String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; - String get referPatient => localizedValues['referPatient'][locale.languageCode]; + String get myReferralPatient => + localizedValues['myReferralPatient'][locale.languageCode]; + + String get referPatient => + localizedValues['referPatient'][locale.languageCode]; String get myReferral => localizedValues['myReferral'][locale.languageCode]; String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; @@ -107,8 +111,10 @@ class TranslationBase { String get profile => localizedValues['profile'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get clinic => localizedValues['clinic'][locale.languageCode]; - String get clinicSelect => localizedValues['clinicSelect'][locale.languageCode]; - String get doctorSelect => localizedValues['doctorSelect'][locale.languageCode]; + String get clinicSelect => + localizedValues['clinicSelect'][locale.languageCode]; + String get doctorSelect => + localizedValues['doctorSelect'][locale.languageCode]; String get hospital => localizedValues['hospital'][locale.languageCode]; String get speciality => localizedValues['speciality'][locale.languageCode]; String get errorMessage => @@ -122,8 +128,10 @@ class TranslationBase { String get lab => localizedValues['lab'][locale.languageCode]; String get result => localizedValues['result'][locale.languageCode]; String get medicines => localizedValues['medicines'][locale.languageCode]; - String get prescription => localizedValues['prescription'][locale.languageCode]; - String get insuranceApprovals => localizedValues['insuranceApprovals'][locale.languageCode]; + String get prescription => + localizedValues['prescription'][locale.languageCode]; + String get insuranceApprovals => + localizedValues['insuranceApprovals'][locale.languageCode]; String get insurance => localizedValues['insurance'][locale.languageCode]; String get approvals => localizedValues['approvals'][locale.languageCode]; String get bodyMeasurements => @@ -145,7 +153,8 @@ class TranslationBase { String get pleaseEnterAnswer => localizedValues['pleaseEnterAnswer'][locale.languageCode]; String get replay => localizedValues['replay'][locale.languageCode]; - String get progressNote => localizedValues['progressNote'][locale.languageCode]; + String get progressNote => + localizedValues['progressNote'][locale.languageCode]; String get progress => localizedValues['progress'][locale.languageCode]; String get note => localizedValues['note'][locale.languageCode]; String get searchNote => localizedValues['searchNote'][locale.languageCode]; @@ -223,8 +232,10 @@ class TranslationBase { String get urgent => localizedValues['urgent'][locale.languageCode]; String get routine => localizedValues['routine'][locale.languageCode]; String get send => localizedValues['send'][locale.languageCode]; - String get referralFrequency => localizedValues['referralFrequency'][locale.languageCode]; - String get selectReferralFrequency => localizedValues['selectReferralFrequency'][locale.languageCode]; + String get referralFrequency => + localizedValues['referralFrequency'][locale.languageCode]; + String get selectReferralFrequency => + localizedValues['selectReferralFrequency'][locale.languageCode]; String get clinicalDetailsAndRemarks => localizedValues['clinicalDetailsAndRemarks'][locale.languageCode]; String get remarks => localizedValues['remarks'][locale.languageCode]; @@ -291,33 +302,89 @@ class TranslationBase { localizedValues['moreThan3Letter'][locale.languageCode]; String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; - String get admissionDetail => localizedValues['admissionDetail'][locale.languageCode]; + String get sickleave => localizedValues['sick-leaves'][locale.languageCode]; + String get patientSick => + localizedValues['patient-sick'][locale.languageCode]; + String get leave => localizedValues['leave'][locale.languageCode]; + String get submit => localizedValues['submit'][locale.languageCode]; + String get doctorName => localizedValues['doc-name'][locale.languageCode]; + String get clinicName => localizedValues['clinicname'][locale.languageCode]; + String get sickLeaveDate => + localizedValues['sick-leave-date'][locale.languageCode]; + String get sickLeaveDays => + localizedValues['sick-leave-days'][locale.languageCode]; + String get admissionDetail => + localizedValues['admissionDetail'][locale.languageCode]; String get dateTime => localizedValues['dateTime'][locale.languageCode]; String get admissionNo => localizedValues['admissionNo'][locale.languageCode]; String get losNo => localizedValues['losNo'][locale.languageCode]; String get area => localizedValues['area'][locale.languageCode]; String get room => localizedValues['room'][locale.languageCode]; String get bed => localizedValues['bed'][locale.languageCode]; + String get previousSickLeaveIssue => + localizedValues['prevoius-sickleave-issed'][locale.languageCode]; + String get noSickLeaveApplied => + localizedValues['no-sickleve-applied'][locale.languageCode]; + String get applyNow => localizedValues['applynow'][locale.languageCode]; + String get addSickLeave => + localizedValues['add-sickleave'][locale.languageCode]; + String get add => localizedValues['add'][locale.languageCode]; + String get approved => localizedValues['approved'][locale.languageCode]; + String get extended => localizedValues['extended'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get leaveStartDate => + localizedValues['leave-start-date'][locale.languageCode]; + String get daysSickleave => + localizedValues['days-sick-leave'][locale.languageCode]; + String get extend => localizedValues['extend'][locale.languageCode]; + String get extendSickLeave => + localizedValues['extend-sickleave'][locale.languageCode]; + String get targetPatient => + localizedValues['patient-target'][locale.languageCode]; + String get noPrescription => + localizedValues['no-priscription-listed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; - String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + String get healthRecordInformation => + localizedValues['healthRecordInformation'][locale.languageCode]; + String get emptyMessage => + localizedValues['empty-message'][locale.languageCode]; + + String get chiefComplaintLength => + localizedValues['chiefComplaintLength'][locale.languageCode]; String get referTo => localizedValues['referTo'][locale.languageCode]; - String get referredFrom => localizedValues['referredFrom'][locale.languageCode]; + String get referredFrom => + localizedValues['referredFrom'][locale.languageCode]; String get branch => localizedValues['branch'][locale.languageCode]; - String get chooseAppointment => localizedValues['chooseAppointment'][locale.languageCode]; - String get appointmentNo => localizedValues['appointmentNo'][locale.languageCode]; + String get chooseAppointment => + localizedValues['chooseAppointment'][locale.languageCode]; + String get appointmentNo => + localizedValues['appointmentNo'][locale.languageCode]; String get refer => localizedValues['refer'][locale.languageCode]; - String get approved => localizedValues['approved'][locale.languageCode]; + String get rejected => localizedValues['rejected'][locale.languageCode]; String get sameBranch => localizedValues['sameBranch'][locale.languageCode]; String get otherBranch => localizedValues['otherBranch'][locale.languageCode]; String get dr => localizedValues['dr'][locale.languageCode]; - String get previewHealth => localizedValues['previewHealth'][locale.languageCode]; - String get summaryReport => localizedValues['summaryReport'][locale.languageCode]; + String get previewHealth => + localizedValues['previewHealth'][locale.languageCode]; + String get summaryReport => + localizedValues['summaryReport'][locale.languageCode]; String get accept => localizedValues['accept'][locale.languageCode]; String get reject => localizedValues['reject'][locale.languageCode]; - String get noAppointmentsErrorMsg => localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; + String get noAppointmentsErrorMsg => + localizedValues['noAppointmentsErrorMsg'][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]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index e72e1317..587c248c 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -363,16 +363,17 @@ class _VerifyAccountState extends State { "IsLoginForDoctorApp": true, "IsSilentLogIN": false }; - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( - zipCode: _loggedUser['ZipCode'], - mobileNumber: _loggedUser['MobileNumber'], - projectID: await sharedPref.getInt(PROJECT_ID), - logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: activationCode, - generalid: "Cs2020@2016\$2958" - ); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = + new CheckActivationCodeRequestModel( + zipCode: _loggedUser['ZipCode'], + mobileNumber: _loggedUser['MobileNumber'], + projectID: await sharedPref.getInt(PROJECT_ID), + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), + activationCode: activationCode, + generalid: "Cs2020@2016\$2958"); - authProv.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) + authProv + .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) .then((res) async { if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); @@ -381,7 +382,7 @@ class _VerifyAccountState extends State { res['List_DoctorProfile'][0], changeLoadingStata); } else { ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); + ClinicModel.fromJson(res['List_DoctorsClinic'][0]); getDocProfiles(clinic, changeLoadingStata); } } else { @@ -404,12 +405,19 @@ class _VerifyAccountState extends State { */ loginProcessCompleted( Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); + var doctor = DoctorProfileModel.fromJson(profile); + authProv.setDoctorProfile(doctor); + sharedPref.setObj(DOCTOR_PROFILE, profile); + this.getDashboard(doctor, changeLoadingStata); + } + getDashboard(doctor, Function changeLoadingStata) { + // authProv.getDashboard(doctor).then((value) { + // print(value); changeLoadingStata(false); - sharedPref.setObj(DOCTOR_PROFILE, profile); + // sharedPref.setObj(DASHBOARD_DATA, value); Navigator.of(context).pushReplacementNamed(HOME); + // }); } Future _asyncSimpleDialog( diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 5c4788f8..e555a807 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -31,6 +32,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); + List mySelectedExamination = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -90,7 +92,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,), + ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index b2cd920f..a1b91864 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,4 +1,10 @@ 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_examination.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'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -7,15 +13,17 @@ 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/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; + final List mySelectedExamination; - ObjectivePage({Key key, this.changePageViewIndex}); + ObjectivePage( + {Key key, this.changePageViewIndex, this.mySelectedExamination}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -23,7 +31,6 @@ class ObjectivePage extends StatefulWidget { class _ObjectivePageState extends State { bool isSysExaminationExpand = false; - List examinationsList; TextEditingController remarksController = TextEditingController(); BoxDecoration containerBorderDecoration( @@ -117,115 +124,141 @@ class _ObjectivePageState extends State { SizedBox( height: 20, ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Abdomen'.toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ + Column( + children: + widget.mySelectedExamination.map((examination) { + return Container( + margin: EdgeInsets.only( + left: 15, right: 15, top: 15), + child: Column(children: [ Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Colors.white,Colors.grey - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Normal", - style: TextStyle( - fontSize: 12, - color: - Colors.black, //Colors.black, - fontWeight: FontWeight.bold, + Texts( + examination + .selectedExamination.nameEn + .toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Colors.white, + Colors.grey), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Normal", + style: TextStyle( + fontSize: 12, + color: + Colors.black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), + )), + ), + onTap: () {}), + SizedBox( + width: 12, ), - onTap: () { - - }), - SizedBox(width: 12,), - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Color(0xFF515A5D), Colors.black - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Abnormal", - style: TextStyle( - fontSize: 12, - color: - Colors.white, //Colors.black, - fontWeight: FontWeight.bold, + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Color(0xFF515A5D), + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Abnormal", + style: TextStyle( + fontSize: 12, + color: + Colors.white, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), - ), - onTap: () { + )), + ), + onTap: () {}), + ], + ), + InkWell( - }), + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeExamination( + examination.selectedExamination), + ) ], ), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ], - ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarksController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + ])); + }).toList(), ) ], ) @@ -249,10 +282,25 @@ class _ObjectivePageState extends State { )); } + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.mySelectedExamination + .where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + + if (history.length > 0) + setState(() { + widget.mySelectedExamination.remove(history.first); + }); + } + openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -275,228 +323,178 @@ class _ObjectivePageState extends State { ); } - ; showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Examinations", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( + return AddExaminationDailog( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey),); + }); + } +} + +class AddExaminationDailog extends StatefulWidget { + final List mySelectedExamination; + final Function addSelectedExamination; + final Function (MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup( + MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => + AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + AppText( + "Examinations", + fontWeight: FontWeight.bold, + fontSize: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery + .of(context) + .size + .height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius + .circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model + .physicalExaminationList + .map((examinationInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: isServiceSelected( + examinationInfo), + activeColor: + Colors.red[800], + onChanged: + ( + bool newValue) { + setState(() { + if (isServiceSelected( + examinationInfo + )) { + widget + .removeExamination( + examinationInfo + ); + } + else { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: examinationInfo + ); + widget + .mySelectedExamination + .add( + mySelectedExamination); + } + }); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + examinationInfo + .nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 10, ), - DividerWithSpacesAround(), - ], - ), - ], - ), - )), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add SELECTED Examinations".toUpperCase(), - onPressed: () {}, - ), - ]), - )), - ); - }); + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED Examinations" + .toUpperCase(), + onPressed: () { + widget.addSelectedExamination(); + }, + ), + ]), + ))), + )), + ); } -} + isServiceSelected(MasterKeyModel masterKey) { + Iterable exam = + widget + .mySelectedExamination + .where((element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index a78f6d0b..ae024b10 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -5,6 +5,8 @@ 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_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; @@ -34,9 +36,9 @@ class _SubjectivePageState extends State { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; - List myHistoryList = List(); TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); + final formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -83,56 +85,64 @@ class _SubjectivePageState extends State { isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Chief Complaints", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: complaintsController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "History of Present Illness", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: illnessController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - AddMedication(), - ]), + bodyWidget: Form( + key: formKey, + child: Column(children: [ + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Chief Complaints", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: complaintsController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else if (value.length < 25) + return TranslationBase + .of(context) + .chiefComplaintLength; + //""; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "History of Present Illness", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: illnessController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + AddMedication(), + ]), + ), isExpand: isChiefExpand, ), @@ -177,7 +187,7 @@ class _SubjectivePageState extends State { ), bodyWidget: Column( children: [ - AddHistoryWidget(myHistoryList: myHistoryList) + AddHistoryWidget(myHistoryList: widget.myHistoryList) ], ), isExpand: isHistoryExpand, @@ -243,58 +253,118 @@ class _SubjectivePageState extends State { SizedBox( height: 30, ), - AppButton( - title: TranslationBase - .of(context) - .next, - - onPressed: () async { - addSubjectiveInfo(model: model, - myAllergiesList: widget.myAllergiesList, - myHistoryList: myHistoryList); - - }, - ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + addSubjectiveInfo( + model: model, + myAllergiesList: widget.myAllergiesList, + myHistoryList: widget.myHistoryList); + }, + ), ], ), ), ), - ),),); + ), + ), + ); } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List< - MasterKeyModel> myHistoryList }) async { - PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + {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); + + widget.changePageViewIndex(1); + } + + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); widget.myAllergiesList.forEach((allergy) { - if(postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: 2500477, - episodeId: 200011502, - appointmentNo: 2016053271, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: 1485, - createdOn: "2020-08-14T20:37:22.780Z", - editedBy: 1485, - editedOn: "2020-08-14T20:37:22.780Z", - isChecked: false, - isUpdatedByNurse: false - )); + //TODO: make static value dynamic + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM + .add(ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: 1485, + // + createdOn: "2020-08-14T20:37:22.780Z", + editedBy: 1485, + editedOn: "2020-08-14T20:37:22.780Z", + isChecked: false, + isUpdatedByNurse: false)); }); await model.postAllergy(postAllergyRequestModel); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); } - widget.changePageViewIndex(1); + } - print(postAllergyRequestModel); + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(); + widget.myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + //TODO: make static value dynamic + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: "", + historyId: history.id, + historyType: history.typeId, + isChecked: false, + )); + }); + await model.postHistories(postHistoriesRequestModel); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } } + postChiefComplaint({SOAPViewModel model}) async { + formKey.currentState.save(); + if(formKey.currentState.validate()){ + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + //TODO: make static value dynamic + new PostChiefComplaintRequestModel( + patientMRN: 3120690, + episodeID: 200012117, + appointmentNo: 2016054573, + chiefComplaint: complaintsController.text, + currentMedication: "currentMedication", + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + numberOfWeeks: 22); + + await model.postChiefComplaint(postChiefComplaintRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + + } } diff --git a/lib/widgets/patients/profile/medication.dart b/lib/widgets/patients/profile/medication.dart new file mode 100644 index 00000000..62494d8e --- /dev/null +++ b/lib/widgets/patients/profile/medication.dart @@ -0,0 +1,13 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class MedicationDetails extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppText('MEDICATION'), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart index a5b9d014..1c9b4462 100644 --- a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -1,11 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; @@ -19,7 +21,41 @@ class PrescriptionInPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: prescriptionReportForInPatientList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + ? Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: + Border.all(color: HexColor('#B8382C'), width: 4), + borderRadius: BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + // openAddPrescription(context); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noPrescription, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), @@ -28,9 +64,12 @@ class PrescriptionInPatientWidget extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return InkWell( onTap: () { - Navigator.of(context).pushNamed(IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { - 'prescription': prescriptionReportForInPatientList[index] - }); + Navigator.of(context).pushNamed( + IN_PATIENT_PRESCRIPTIONS_DETAILS, + arguments: { + 'prescription': + prescriptionReportForInPatientList[index] + }); }, child: CardWithBgWidgetNew( widget: Column( diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index fd43e48d..b4ceffb4 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -1,11 +1,14 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient_prescription_details_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/medication.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; @@ -18,7 +21,41 @@ class PrescriptionOutPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: patientPrescriptionsList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + ? Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: + Border.all(color: HexColor('#B8382C'), width: 4), + borderRadius: BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openAddPrescription(context); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noPrescription, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), @@ -91,4 +128,12 @@ class PrescriptionOutPatientWidget extends StatelessWidget { ), ); } + + openAddPrescription(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (context) { + return MedicationDetails(); + }); + } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 9d97a1ad..3c3e133d 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -27,13 +27,14 @@ class ProfileMedicalInfoWidget extends StatelessWidget { mainAxisSpacing: 20, crossAxisCount: 2, childAspectRatio: 1.5, - children: [ PatientProfileButton( - key: key, - patient: patient, - nameLine1: "Create New", - nameLine2: "Episode", - route: CREATE_EPISODE, - icon: 'heartbeat.png'), + children: [ + PatientProfileButton( + key: key, + patient: patient, + nameLine1: "Create New", + nameLine2: "Episode", + route: CREATE_EPISODE, + icon: 'heartbeat.png'), PatientProfileButton( key: key, patient: patient, @@ -98,6 +99,15 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).list, icon: 'radiology-1.png')), + Visibility( + visible: selectedPatientType != 0 && selectedPatientType != 5, + child: PatientProfileButton( + key: key, + patient: patient, + route: ADD_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, + icon: 'sick_leaves_icons.png')), ]); } } @@ -150,3 +160,89 @@ class CircleAvatarWidget extends StatelessWidget { ); } } + +class PatientProfileButton extends StatelessWidget { + final String nameLine1; + final String nameLine2; + final String icon; + final dynamic route; + final PatiantInformtion patient; + final String url = "assets/images/"; + PatientProfileButton( + {Key key, + this.patient, + this.nameLine1, + this.nameLine2, + this.icon, + this.route}) + : super(key: key); + @override + Widget build(BuildContext context) { + return new Container( + margin: new EdgeInsets.symmetric(horizontal: 4.0), + child: InkWell( + onTap: () { + navigator(context, this.route); + }, + child: Column(children: [ + Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + this.nameLine1, + color: Color(0xFFB9382C), + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), + AppText( + this.nameLine2, + color: Colors.black, + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), + ], + ), + ), + Expanded( + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(10), + child: new Image.asset(url + icon)) + ], + )), + ) + ]), + ), + decoration: BoxDecoration( + // border: Border.all(), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10)), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffBBBBBB), + width: 1, + )), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + spreadRadius: 5, + blurRadius: 7, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + padding: EdgeInsets.fromLTRB(5, 10, 5, 5), + ); + } + + void navigator(BuildContext context, route) { + Navigator.of(context).pushNamed(route, arguments: {'patient': patient}); + } +} diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index e41b4379..fec58e89 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -157,7 +157,7 @@ class _TextFieldsState extends State { : Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), + errorStyle: TextStyle(fontSize: 12.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), errorBorder: OutlineInputBorder( borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index d01fe5af..85b0483d 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -14,50 +14,78 @@ class AppButton extends StatefulWidget { final Color color; final double fontSize; final double padding; + final bool loading; + final bool disabled; - AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 13}); + AppButton( + {@required this.onPressed, + this.title, + this.icon, + this.color, + this.fontSize = 2, + this.padding = 13, + this.loading = false, + this.disabled = false}); _AppButtonState createState() => _AppButtonState(); - } class _AppButtonState extends State{ @override Widget build(BuildContext context) { - return - RawMaterialButton( - fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), - splashColor: widget.color, - child: Padding( - padding: EdgeInsets.only( - top: widget.padding, - bottom: widget.padding, - //right: SizeConfig.widthMultiplier * widget.padding, - //left: SizeConfig.widthMultiplier * widget.padding - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (widget.icon != null) - Icon( - widget.icon, - color: Colors.white, - ), - if (widget.icon != null) - SizedBox( - width: 5.0, - ), - AppText( - widget.title.toUpperCase(), - color: Colors.white, - fontSize: SizeConfig.textMultiplier * widget.fontSize , - ), - ], + return + IgnorePointer( + ignoring: widget.loading, + child: RawMaterialButton( + fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), + splashColor: widget.color, + child: Padding( + padding: EdgeInsets.only( + top: widget.padding, + bottom: widget.padding, + //right: SizeConfig.widthMultiplier * widget.padding, + //left: SizeConfig.widthMultiplier * widget.padding + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.icon != null) + Icon( + widget.icon, + color: Colors.white, + ), + if (widget.icon != null) + SizedBox( + width: 5.0, + ), + widget.loading + ? Padding( + padding: EdgeInsets.all(2.6), + child: SizedBox( + height: 19.0, + width: 19.0, + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: + AlwaysStoppedAnimation( + Colors.grey[300], + ), + ), + ), + ) + : AppText( + widget.title.toUpperCase(), + color: Colors.white, + fontSize: SizeConfig.textMultiplier * widget.fontSize, + ), + ], + ), ), + onPressed: widget.onPressed, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6))), ), - onPressed: widget.onPressed, - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))), - ); + ); } } \ No newline at end of file diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index b9dd3fc2..5819e805 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -24,6 +24,7 @@ class AppTextFormField extends FormField { ValueChanged onFieldSubmitted, IconButton prefix, String labelText, + bool readOnly = false, borderColor}) : super( onSaved: onSaved, @@ -33,44 +34,53 @@ class AppTextFormField extends FormField { return Column( children: [ SizedBox( - height: 40.0, - child: TextFormField( - focusNode: focusNode, - keyboardType: textInputType, - inputFormatters: [FilteringTextInputFormatter.allow(RegExp(inputFormatter)), - ],onChanged: onChanged?? (value){ - state.didChange(value); - }, - textInputAction: textInputAction, - onFieldSubmitted: onFieldSubmitted, - decoration: InputDecoration( - hintText: hintText, - suffixIcon: prefix, - hintStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.8,), - contentPadding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - labelText: labelText, - labelStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.7,), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(6)), - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - borderRadius: BorderRadius.all(Radius.circular(6)), - ) - //BorderRadius.all(Radius.circular(20)); - ), - onTap: onTap, - controller: controller, - ), - ), - state.hasError + height: 40.0, + child: TextFormField( + focusNode: focusNode, + keyboardType: textInputType, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(inputFormatter)), + ], + onChanged: onChanged ?? + (value) { + state.didChange(value); + }, + textInputAction: textInputAction, + onFieldSubmitted: onFieldSubmitted, + decoration: InputDecoration( + hintText: hintText, + suffixIcon: prefix, + hintStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.8, + ), + contentPadding: + EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + labelText: labelText, + labelStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(6)), + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6)), + ) + //BorderRadius.all(Radius.circular(20)); + ), + onTap: onTap, + controller: controller, + ), + ), + state.hasError ? Text( state.errorText, style: TextStyle(color: Colors.red), diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index e52dab51..d5320bb9 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -20,7 +20,7 @@ class AppText extends StatefulWidget { final bool visibility; final TextAlign textAlign; final Color backGroundcolor; - + final TextOverflow textOverflow; AppText(this.data, {this.color = Colors.black, this.fontWeight = FontWeight.normal, @@ -33,6 +33,7 @@ class AppText extends StatefulWidget { this.marginLeft = 0, this.visibility = true, this.textAlign, + this.textOverflow, this.backGroundcolor = Colors.white}); @override @@ -55,7 +56,7 @@ class _AppTextState extends State { child: Text( widget.data, textAlign: widget.textAlign, - overflow: TextOverflow.clip, + overflow: widget.textOverflow ?? TextOverflow.clip, style: TextStyle( color: widget.color, fontWeight: widget.fontWeight, diff --git a/pubspec.yaml b/pubspec.yaml index 5e8563cd..aa7499d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.6.0 <3.0.0" + sdk: ">=2.8.0 <3.0.0" dependencies: flutter: @@ -54,7 +54,7 @@ dependencies: cupertino_icons: ^0.1.2 # SVG #flutter_svg: ^0.17.4 - percent_indicator: "^2.1.1" + percent_indicator: ^2.1.1 #Dependency Injection get_it: ^4.0.2 @@ -86,7 +86,7 @@ flutter: assets: - assets/images/ - assets/images/dashboard/ - # - images/a_dot_ham.jpeg + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.