diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 86704430..6d0a5a66 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -113,6 +113,8 @@ class BaseAppClient { // } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + // body['ClinicID'] = 501; + // body['ProjectID'] = 12; // body['DoctorID'] = 1002; //3844083 // body['TokenID'] = "@dm!n"; @@ -347,8 +349,9 @@ class BaseAppClient { get({required String endPoint, required Function(dynamic response, int statusCode) onSuccess, required Function(String error, int statusCode) onFailure}) async { String token = await sharedPref.getString(TOKEN); String url = DOCTOR_ROTATION + endPoint + '&token=' + token; - + print(url); final response = await http.get(Uri.parse(url)); + final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400) { onFailure(Utils.generateContactAdminMsg(), statusCode); diff --git a/lib/client/http_Overrides.dart b/lib/client/http_Overrides.dart new file mode 100644 index 00000000..d2a470ba --- /dev/null +++ b/lib/client/http_Overrides.dart @@ -0,0 +1,8 @@ +import 'dart:io'; + +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true; + } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index 60021613..831c9cdf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,7 +19,7 @@ const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; -const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplicathttps://uat.hmgwebservices.com/Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorAppion.svc/REST/GetProgressNoteForInPatient"; const PATIENT_INSURANCE_APPROVALS_URL = "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; const PATIENT_REFER_TO_DOCTOR_URL = "Services/DoctorApplication.svc/REST/ReferToDoctor"; const PATIENT_GET_DOCTOR_BY_CLINIC_URL = "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; diff --git a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart index a73ecb0b..e9b8b117 100644 --- a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart @@ -9,7 +9,7 @@ class PatientRegistrationModel { String? iPAdress; String? generalid; int? patientOutSA; - Null sessionID; + dynamic sessionID; bool? isDentalAllowedBackend; int? deviceTypeID; String? tokenID; @@ -39,9 +39,7 @@ class PatientRegistrationModel { this.zipCode}); PatientRegistrationModel.fromJson(Map json) { - patientobject = json['Patientobject'] != null - ? new Patientobject.fromJson(json['Patientobject']) - : null; + patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null; patientIdentificationID = json['PatientIdentificationID']; patientMobileNumber = json['PatientMobileNumber']; logInTokenID = json['LogInTokenID']; diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index c2ec316a..9a3079f3 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -3,11 +3,11 @@ import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList. import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/add_patient_to_doctor_list_request_model.dart'; import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/livecare/end_call_req.dart'; import 'package:doctor_app_flutter/core/model/livecare/start_call_req.dart'; import 'package:doctor_app_flutter/core/model/livecare/start_call_res.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class LiveCarePatientServices extends BaseService { List _patientList = []; @@ -34,9 +34,7 @@ class LiveCarePatientServices extends BaseService { StartCallRes get startCallRes => _startCallRes; - Future getPendingPatientERForDoctorApp( - PendingPatientERForDoctorAppRequestModel - pendingPatientERForDoctorAppRequestModel) async { + Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async { hasError = false; await baseAppClient.post( GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, @@ -49,10 +47,7 @@ class LiveCarePatientServices extends BaseService { /// add new items. localPatientList.forEach((element) { - if ((_patientList.singleWhere( - (it) => it.patientId == element.patientId, - orElse: () => PatiantInformtion())) == - null) { + if (!_patientList.any((it) => it.patientId == element.patientId)) { _patientList.add(element); } }); @@ -60,10 +55,7 @@ class LiveCarePatientServices extends BaseService { /// remove items. List removedPatientList = []; _patientList.forEach((element) { - if ((localPatientList.singleWhere( - (it) => it.patientId == element.patientId, - orElse: () => PatiantInformtion())) == - null) { + if (localPatientList.any((it) => it.patientId == element.patientId)) { removedPatientList.add(element); } }); @@ -92,8 +84,7 @@ class LiveCarePatientServices extends BaseService { Future startCall(StartCallReq startCallReq) async { hasError = false; - await baseAppClient.post(START_LIVE_CARE_CALL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async { _startCallRes = StartCallRes.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -103,23 +94,17 @@ class LiveCarePatientServices extends BaseService { Future endCallWithCharge(int vcID, List altServiceList) async { hasError = false; - await baseAppClient.post(END_CALL_WITH_CHARGE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) { endCallResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: { - "VC_ID": vcID, - "AltServiceList": altServiceList, - "generalid": GENERAL_ID - }, isLiveCare: _isLive); + }, body: {"VC_ID": vcID, "AltServiceList": altServiceList, "generalid": GENERAL_ID}, isLiveCare: _isLive); } Future transferToAdmin(int vcID, String notes) async { hasError = false; - await baseAppClient.post(TRANSFERT_TO_ADMIN, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) { transferToAdminResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -133,8 +118,7 @@ class LiveCarePatientServices extends BaseService { Future sendSMSInstruction(int vcID) async { hasError = false; - await baseAppClient.post(SEND_SMS_INSTRUCTIONS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SEND_SMS_INSTRUCTIONS, onSuccess: (dynamic response, int statusCode) { transferToAdminResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -142,14 +126,11 @@ class LiveCarePatientServices extends BaseService { }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); } - Future isLogin( - {LiveCareUserLoginRequestModel? isLoginRequestModel, - int? loginStatus}) async { + Future isLogin({LiveCareUserLoginRequestModel? isLoginRequestModel, int? loginStatus}) async { hasError = false; await getDoctorProfile(); isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID; - await baseAppClient.post(LIVE_CARE_IS_LOGIN, - onSuccess: (response, statusCode) async { + await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -161,8 +142,7 @@ class LiveCarePatientServices extends BaseService { hasError = false; alternativeServicesList.clear(); - await baseAppClient.post(GET_ALTERNATIVE_SERVICE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALTERNATIVE_SERVICE, onSuccess: (dynamic response, int statusCode) { response['AlternativeServicesList'].forEach((v) { alternativeServicesList.add(AlternativeService.fromJson(v)); }); @@ -175,16 +155,14 @@ class LiveCarePatientServices extends BaseService { Future addPatientToDoctorList({int? vcID}) async { hasError = false; await getDoctorProfile(); - AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = - AddPatientToDoctorListRequestModel(); + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; - await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -194,16 +172,14 @@ class LiveCarePatientServices extends BaseService { Future removePatientFromDoctorList({int? vcID}) async { hasError = false; - AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = - AddPatientToDoctorListRequestModel(); + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); await getDoctorProfile(); addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; - await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, - onSuccess: (response, statusCode) async { + await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 0d1e30f9..35358ad0 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -137,12 +137,15 @@ class SOAPViewModel extends BaseViewModel { planCallBack.nextFunction(model); } - Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = ""}) async { + Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = "", bool allowSetState = false}) async { if (isBusyLocal) { setState(ViewState.Busy); - } else { + } else setState(ViewState.Busy); - } + + //else + // setState(ViewState.Busy); + await _SOAPService.getMasterLookup(masterKeys, searchKey: searchKey); if (_SOAPService.hasError) { error = _SOAPService.error; @@ -559,7 +562,7 @@ class SOAPViewModel extends BaseViewModel { final results = services; if (_SOAPService.hasError || _prescriptionService.hasError) { - error = _SOAPService.error! + _prescriptionService.error!; + error = _SOAPService.error.toString() + _prescriptionService.error.toString(); if (allowSetState) setState(ViewState.ErrorLocal); } else if (allowSetState) setState(ViewState.Idle); } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 7e21feb8..af282ea4 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -66,7 +66,7 @@ class AuthenticationViewModel extends BaseViewModel { bool unverified = false; bool isFromLogin = false; APP_STATUS appStatus = APP_STATUS.LOADING; - String localToken = ""; + String? localToken = ""; bool isHuawei = false; AuthenticationViewModel({bool checkDeviceInfo = false}) { diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index a8049465..97698274 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -25,7 +25,7 @@ class BaseViewModel extends ChangeNotifier { Future getDoctorProfile({bool isGetProfile = false}) async { if (isGetProfile) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); if (doctorProfile != null) { diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index d786b98a..34451000 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -30,7 +30,7 @@ class PatientReferralViewModel extends BaseViewModel { List? get branchesList => _referralPatientService.projectsList; - List get clinicsList => _referralPatientService.clinicsList; + List? get clinicsList => _referralPatientService.clinicsList; List get referralFrequencyList => _referralPatientService.frequencyList; diff --git a/lib/main.dart b/lib/main.dart index ad3be8ab..92478404 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,6 @@ +import 'dart:io'; + +import 'package:doctor_app_flutter/client/http_Overrides.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; @@ -18,6 +21,7 @@ import 'package:provider/provider.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); + HttpOverrides.global = MyHttpOverrides(); setupLocator(); runApp(MyApp()); } diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index 1ab0b411..9333080a 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -1,20 +1,20 @@ import 'dart:async'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; -import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart'; import 'package:flutter/material.dart'; -import '../../routes.dart'; +import '../../utils/translations_delegate_base_utils.dart'; +import '../../widgets/shared/errors/error_message.dart'; class LiveCarePatientScreen extends StatefulWidget { @override @@ -102,6 +102,74 @@ class _LiveCarePatientScreenState extends State { shrinkWrap: true, itemCount: model.filterData.length, itemBuilder: (BuildContext ctxt, int index) { + // + + String jsonString = ''' + { + "PatientID": 1231755, + "SetupID": "010266", + "PatientType": 1, + "FirstName": "TAMER", + "MiddleName": "MUSA", + "LastName": "FANASHEH", + "FirstNameN": "", + "MiddleNameN": "موسى", + "LastNameN": "", + "Gender": 1, + "DateofBirth": "/Date(558910800000+0300)/", + "DateofBirthN": "25/01/1408", + "NationalityID": "JOR", + "PhoneResi": "", + "PhoneOffice": "", + "MobileNumber": "0537503378", + "FaxNumber": "", + "EmailAddress": "sultan.khan@cloudsolutions.com.sa", + "IsEmailAlertRequired": true, + "IsSMSAlertRequired": true, + "PreferredLanguage": "1", + "EmergencyContactName": "MOH", + "EmergencyContactNo": "0507845867", + "PatientIdentificationType": 2, + "PatientIdentificationNo": "2344670985", + "ProjectID": 15, + "ReceiveHealthSummaryReport": true, + "NoShowCount": 0, + "IsPatientHasMobileDeviceToken": true, + "EditedBy": 102, + "IsIVRStopped": true, + "CRSClientIdentifierID": null, + "CRSVerificationStatus": null, + "CRSVerifiedBy": null, + "CRSVerificationStatusDesc": "Sent for Manual Verification", + "CRSVerificationStatusDescN": "Sent for Manual Verification", + "NumberPosition": 1, + "Status": 2, + "IsPrivilegedMember": null, + "Address": "gffffff al malga", + "Age": 36, + "EmaiLAddress": "sultan.khan@cloudsolutions.com.sa", + "GenderDescription": "Male", + "GenderImage": "https://hmgwebservices.com/Images/GenderAvtar/Male.jpg", + "IsPatientDataVerified": false, + "IsPatientPrivilegedMember": false, + "NationalityDescription": "Jordanian", + "NationalityFlagURL": "https://hmgwebservices.com/Images/flag/JOR.png", + "POBox": "", + "PatientDataVerified": 3, + "PatientName": "TAMER MUSA FANASHEH", + "PatientTypeDescription": "Permanent File", + "PatientTypeDescriptionN": null, + "StatusDscription": "Active ", + "TempAddress": "", + "UpcomingAppointmentsNumber": 0, + "ZipCode": "966" + } + '''; + + // Map jsonObject = json.decode(jsonString); + + // + return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( @@ -112,7 +180,7 @@ class _LiveCarePatientScreenState extends State { isInpatient: false, isFromLiveCare: true, onTap: () { - // TODO change the parameter to daynamic + // TODO change the parameter to daynamic Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), "patientType": "0", @@ -122,6 +190,13 @@ class _LiveCarePatientScreenState extends State { "isSearchAndOut": false, "isFromLiveCare": true, }); + + // AppPermissionsUtils.requestVideoCallPermission( + // context: context, + // onTapGrant: () { + // locator().openVideo(model.startCallRes!, PatiantInformtion.fromJson(model.filterData[index].toJson()), + // model.startCallRes != null ? model.startCallRes!.isRecording! : true, callConnected, callDisconnected); + // }); }, // isFromSearch: widget.isSearch, ), diff --git a/lib/screens/patients/patient_search/patient_search_result_screen.dart b/lib/screens/patients/patient_search/patient_search_result_screen.dart index 8447964e..61e97597 100644 --- a/lib/screens/patients/patient_search/patient_search_result_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_result_screen.dart @@ -99,6 +99,7 @@ class _PatientsSearchResultScreenState extends State scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model.filterData.length, + padding: EdgeInsets.zero, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), @@ -109,11 +110,6 @@ class _PatientsSearchResultScreenState extends State isFromSearch: widget.isSearchAndOut, isInpatient: widget.isInpatient, onTap: () { - print("TODO change the parameter to daynamic"); - print("TODO change the parameter to daynamic"); - print("TODO change the parameter to daynamic"); - print("TODO change the parameter to daynamic"); - print("TODO change the parameter to daynamic"); // TODO change the parameter to daynamic Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": model.filterData[index], diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart index 418b800b..0aa2c21d 100644 --- a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -1,10 +1,10 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; @@ -33,19 +33,17 @@ class _ProgressNoteState extends State { AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); late ProjectViewModel projectViewModel; - getProgressNoteList(BuildContext context, PatientViewModel model, - {bool isLocalBusy = false}) async { + getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); + String? type = await sharedPref.getString(SLECTED_PATIENT_TYPE); print(type); - GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel = - GetNursingProgressNoteRequestModel( - admissionNo: int.parse(patient.admissionNo!), - patientTypeID: patient.patientType, - patientID: patient.patientId, - ); + GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel = GetNursingProgressNoteRequestModel( + admissionNo: int.parse(patient.admissionNo!), + patientTypeID: patient.patientType, + patientID: patient.patientId, + ); model.getNursingProgressNote(getNursingProgressNoteRequestModel); } @@ -55,8 +53,7 @@ class _ProgressNoteState extends State { projectViewModel = Provider.of(context); final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - if (routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => getProgressNoteList(context, model), builder: (_, model, w) => AppScaffold( @@ -67,8 +64,7 @@ class _ProgressNoteState extends State { patient, isInpatient: true, ), - body: model.patientNursingProgressNoteList == null || - model.patientNursingProgressNoteList.length == 0 + body: model.patientNursingProgressNoteList == null || model.patientNursingProgressNoteList.length == 0 ? Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, @@ -81,8 +77,7 @@ class _ProgressNoteState extends State { Expanded( child: Container( child: ListView.builder( - itemCount: - model.patientNursingProgressNoteList.length, + itemCount: model.patientNursingProgressNoteList.length, itemBuilder: (BuildContext ctxt, int index) { return FractionallySizedBox( widthFactor: 0.95, @@ -92,48 +87,31 @@ class _ProgressNoteState extends State { widget: Column( children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, + width: MediaQuery.of(context).size.width * 0.60, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of( - context) - .createdBy, + TranslationBase.of(context).createdBy, fontSize: 10, ), Expanded( child: AppText( - model - .patientNursingProgressNoteList[ - index] - .createdByName - .toString() ?? - '', - fontWeight: - FontWeight.w600, + model.patientNursingProgressNoteList[index].createdByName.toString() ?? '', + fontWeight: FontWeight.w600, fontSize: 12, isCopyable: true, ), @@ -146,73 +124,39 @@ class _ProgressNoteState extends State { Column( children: [ AppText( - model - .patientNursingProgressNoteList[ - index] - .createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromServerFormat(model - .patientNursingProgressNoteList[ - index] - .createdOn!), - isArabic: - projectViewModel - .isArabic, - isMonthShort: true) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now(), - isArabic: - projectViewModel - .isArabic), + model.patientNursingProgressNoteList[index].createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.patientNursingProgressNoteList[index].createdOn!), + isArabic: projectViewModel.isArabic, isMonthShort: true) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic), fontWeight: FontWeight.w600, fontSize: 14, isCopyable: true, ), AppText( - model - .patientNursingProgressNoteList[ - index] - .createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils - .getDateTimeFromServerFormat(model - .patientNursingProgressNoteList[ - index] - .createdOn!)) - : AppDateUtils.getHour( - DateTime.now()), + model.patientNursingProgressNoteList[index].createdOn != null + ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(model.patientNursingProgressNoteList[index].createdOn!)) + : AppDateUtils.getHour(DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, isCopyable: true, ), ], - crossAxisAlignment: - CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, ) ], ), SizedBox( height: 8, ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - model - .patientNursingProgressNoteList[ - index] - .notes!, - fontSize: 10, - isCopyable: true, - ), - ), - ]) + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + Expanded( + child: AppText( + model.patientNursingProgressNoteList[index].notes!, + fontSize: 10, + isCopyable: true, + ), + ), + ]) ], ), SizedBox( diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index d0622caf..80162a49 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -203,8 +203,8 @@ class _PatientProfileScreenState extends State with Single arrivalType: arrivalType!, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - from: from!, - to: to!, + from: from ?? "", + to: to ?? "", projectViewModel: projectViewModel, ), ), diff --git a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart index 8b24e722..cfc38b6a 100644 --- a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart @@ -279,10 +279,10 @@ class _PatientMakeInPatientReferralScreenState extends State 0 + onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList!.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( - list: model.clinicsList, + list: model.clinicsList!, attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', usingSearch: true, diff --git a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen.dart index eb520051..d92a54f1 100644 --- a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen.dart @@ -264,10 +264,10 @@ class _PatientMakeReferralScreenState extends State { enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, - onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0 + onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList!.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( - list: model.clinicsList, + list: model.clinicsList!, attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', usingSearch: true, diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index d2696e1c..64d8caf8 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -1,25 +1,23 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; + import 'examinations_list_search_widget.dart'; class AddExaminationPage extends StatefulWidget { final List? mySelectedExamination; - final Function(List)? addSelectedExamination; - final Function(MasterKeyModel)? removeExamination; + final Function(List) addSelectedExamination; + final Function(MasterKeyModel) removeExamination; - AddExaminationPage( - {this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}); + AddExaminationPage({this.mySelectedExamination, required this.addSelectedExamination, required this.removeExamination}); @override _AddExaminationPageState createState() => _AddExaminationPageState(); @@ -39,7 +37,9 @@ class _AddExaminationPageState extends State { return BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); + await model.getMasterLookup( + MasterKeysService.PhysicalExamination, + ); } }, builder: (_, model, w) => AppScaffold( @@ -71,21 +71,17 @@ class _AddExaminationPageState extends State { child: Column( children: [ ExaminationsListSearchWidget( - mySelectedExamination: - widget.mySelectedExamination!, + mySelectedExamination: widget.mySelectedExamination!, masterList: model.physicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), + isServiceSelected: (master) => isServiceSelected(master), removeExamination: (selectedExamination) { setState(() { - mySelectedExaminationLocal - .remove(selectedExamination); + mySelectedExaminationLocal.remove(selectedExamination); }); }, addExamination: (selectedExamination) { - mySelectedExaminationLocal.insert( - 0, selectedExamination); - // setState(() {}); + mySelectedExaminationLocal.insert(0, selectedExamination); + //setState(() {}); }, ), ], @@ -104,19 +100,16 @@ class _AddExaminationPageState extends State { : CustomBottomSheetContainer( label: "${TranslationBase.of(context).addExamination}", onTap: () { - widget - .addSelectedExamination!(mySelectedExaminationLocal); + widget.addSelectedExamination(mySelectedExaminationLocal); }, ), )); } isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = mySelectedExaminationLocal.where( - (element) => - masterKey.id == element.selectedExamination!.id && - masterKey.typeId == element.selectedExamination!.typeId); + Iterable exam = mySelectedExaminationLocal.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId); if (exam.length > 0) { + print("--------------"); return true; } return false; diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index 8058a638..c7f015f8 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -14,9 +14,9 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationWidget extends StatefulWidget { MasterKeyModel? item; - final Function(MySelectedExamination)? removeExamination; - final Function(MySelectedExamination)? addExamination; - final bool Function(MasterKeyModel)? isServiceSelected; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; bool isExpand; final Function() expandClick; @@ -24,9 +24,9 @@ class AddExaminationWidget extends StatefulWidget { AddExaminationWidget({ this.item, - this.removeExamination, - this.addExamination, - this.isServiceSelected, + required this.removeExamination, + required this.addExamination, + required this.isServiceSelected, this.isExpand = false, required this.expandClick, this.mySelectedExamination, @@ -73,7 +73,7 @@ class _AddExaminationWidgetState extends State { child: Row( children: [ Checkbox( - value: widget.isServiceSelected!(widget.item!), + value: widget.isServiceSelected(widget.item!), activeColor: Colors.red[800], onChanged: (bool? newValue) { onExamTap(); @@ -262,16 +262,16 @@ class _AddExaminationWidgetState extends State { onExamTap() { setState(() { - if (widget.isServiceSelected!(widget.item!)) { - if (examination.isLocal) widget.removeExamination!(examination); - widget.expandClick; + if (widget.isServiceSelected(widget.item!)) { + if (examination.isLocal) widget.removeExamination(examination); + widget.expandClick(); } else { examination.isNormal = status == 1; examination.isAbnormal = status == 2; examination.notExamined = status == 3; examination.remark = remarksController.text; - widget.addExamination!(examination); - widget.expandClick; + widget.addExamination(examination); + widget.expandClick(); } }); } diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 025634f8..c27eefb2 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -9,13 +9,13 @@ import 'package:flutter/material.dart'; import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { - final Function(MySelectedExamination)? removeExamination; - final Function(MySelectedExamination)? addExamination; - final bool Function(MasterKeyModel)? isServiceSelected; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; final List? masterList; final List? mySelectedExamination; - ExaminationsListSearchWidget({this.removeExamination, this.addExamination, this.isServiceSelected, this.masterList, this.mySelectedExamination}); + ExaminationsListSearchWidget({required this.removeExamination, required this.addExamination, required this.isServiceSelected, this.masterList, this.mySelectedExamination}); @override _ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState(); diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index c89b16a2..62f764e6 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -54,9 +54,7 @@ class _AddMedicationState extends State { return FractionallySizedBox( child: BaseView( onModelReady: (model) async { - model.onAddMedicationStart(allowSetState: false).whenComplete(() { - setState(() {}); - }); + model.onAddMedicationStart(allowSetState: false).whenComplete(() {}); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/prescription/new_prescriptions_page.dart b/lib/screens/prescription/new_prescriptions_page.dart index bbb2cf11..a793871e 100644 --- a/lib/screens/prescription/new_prescriptions_page.dart +++ b/lib/screens/prescription/new_prescriptions_page.dart @@ -26,7 +26,7 @@ class NewPrescriptionsPage extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; return BaseView( onModelReady: (model) async { - model.getPrescriptionListNew(mrn: patient.patientMRN, appNo: patient.appointmentNo); + model.getPrescriptionListNew(mrn: patient.patientMRN, appNo: patient.appointmentNo ?? 0); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/prescription/old_prescriptions_page.dart b/lib/screens/prescription/old_prescriptions_page.dart index 9d01fd2b..523f3549 100644 --- a/lib/screens/prescription/old_prescriptions_page.dart +++ b/lib/screens/prescription/old_prescriptions_page.dart @@ -101,8 +101,7 @@ class OldPrescriptionsPage extends StatelessWidget { ), ), ) - : Center( - child: FractionallySizedBox( + : FractionallySizedBox( widthFactor: 0.9, child: SingleChildScrollView( child: Column( @@ -182,7 +181,7 @@ class OldPrescriptionsPage extends StatelessWidget { ], ), ), - ), + ))); } } diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index fa167fff..16099da5 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -56,8 +56,8 @@ class PatientCard extends StatelessWidget { decoration: Utils.getCardBoxDecoration(), child: CardWithBgWidget( padding: 0, - marginLeft: (!isMyPatient && isInpatient) || isFromLiveCare ? 0 : 10, - marginSymmetric: isFromSearch ? 10 : 0.0, + marginLeft: (!isMyPatient && isInpatient) || isFromLiveCare ? 0 : 0, + marginSymmetric: isFromSearch ? 0 : 0.0, hasBorder: false, bgColor: isFromLiveCare ? Colors.white @@ -292,7 +292,7 @@ class PatientCard extends StatelessWidget { ), Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(left: 12.0, top: 5), + padding: EdgeInsets.only(left: 12.0, top: 5, bottom: 10), child: Container( width: 60, height: 60, @@ -394,7 +394,7 @@ class PatientCard extends StatelessWidget { children: [ CustomRow( label: TranslationBase.of(context).clinic + " : ", - value: patientInfo!.clinicName!, + value: patientInfo!.clinicName ?? "", ), ], ), diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index 5d032c73..d5fd9ed2 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -25,7 +25,7 @@ class _MasterKeyDailogState extends State { @override void initState() { super.initState(); - widget.selectedValue = widget.selectedValue ?? widget.list[0]; + widget.selectedValue = widget.selectedValue ?? widget.list.first; } @override