From 0e836c67c8997d6b4fd070b18ec0da15eec98b83 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 24 Apr 2021 14:53:41 +0300 Subject: [PATCH 1/2] medical file hot fix --- .../medical-file/medical_file_page.dart | 167 ++++++++++-------- lib/widgets/shared/doctor_card.dart | 13 +- 2 files changed, 103 insertions(+), 77 deletions(-) diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 721a0bb8..1d354ac3 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -85,80 +85,103 @@ class _MedicalFilePageState extends State { itemBuilder: (BuildContext ctxt, int index) { return InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicalFileDetails( - age: patient.age is String - ? patient.age ?? "" - : "${patient.age}", - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - encounterNumber: index, - pp: patient.patientId, - patient: patient, - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName - : "", - clinicName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .clinicName - : "", - doctorImage: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage - : "", - episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty - ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() - : "", - vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), - ); + if (model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .length != + 0) + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicalFileDetails( + age: patient.age is String + ? patient.age ?? "" + : "${patient.age}", + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientId, + patient: patient, + doctorName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName + : "", + clinicName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .clinicName + : "", + doctorImage: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorImage + : "", + episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty + ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() + : "", + vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), + ); }, child: DoctorCard( - doctorName: model.medicalFileList[0] - .entityList[0].timelines[index].doctorName, - clinic: model.medicalFileList[0].entityList[0] - .timelines[index].clinicName, - branch: model.medicalFileList[0].entityList[0] - .timelines[index].projectName, - profileUrl: model.medicalFileList[0] - .entityList[0].timelines[index].doctorImage, - appointmentDate: - DateUtils.getDateTimeFromServerFormat( - model.medicalFileList[0].entityList[0] - .timelines[index].date, - ), - isPrescriptions: true, - ), + doctorName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName, + clinic: model.medicalFileList[0].entityList[0] + .timelines[index].clinicName, + branch: model.medicalFileList[0].entityList[0] + .timelines[index].projectName, + profileUrl: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorImage, + appointmentDate: + DateUtils.getDateTimeFromServerFormat( + model.medicalFileList[0].entityList[0] + .timelines[index].date, + ), + isPrescriptions: true, + isShowEye: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .length != + 0 + ? true + : false), ); }) : Center( diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index c86e0211..48782921 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -21,6 +21,7 @@ class DoctorCard extends StatelessWidget { final Function onTap; final bool isPrescriptions; final String clinic; + final bool isShowEye; DoctorCard( {this.doctorName, @@ -31,7 +32,8 @@ class DoctorCard extends StatelessWidget { this.appointmentDate, this.orderNo, this.isPrescriptions = false, - this.clinic}); + this.clinic, + this.isShowEye = true}); @override Widget build(BuildContext context) { @@ -50,7 +52,7 @@ class DoctorCard extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(15.0), child: InkWell( - onTap: onTap, + onTap: (isShowEye) ? onTap : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -169,9 +171,10 @@ class DoctorCard extends StatelessWidget { ]), ), ), - Icon( - EvaIcons.eye, - ) + if (isShowEye) + Icon( + EvaIcons.eye, + ) ], ), ), From 460a5293b97814943024c1369a97e5c8dc9ce397 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sat, 24 Apr 2021 15:32:56 +0300 Subject: [PATCH 2/2] add Discharged Patient --- lib/config/config.dart | 2 + lib/core/model/DischargeReferralPatient.dart | 216 ++++++++++++ .../service/DischargedPatientService.dart | 76 +++++ .../service/MyReferralPatientService.dart | 2 +- .../service/referral_patient_service.dart | 4 - .../viewModel/DischargedPatientViewModel.dart | 69 ++++ lib/locator.dart | 4 + lib/models/patient/patiant_info_model.dart | 10 +- lib/screens/home/home_screen.dart | 40 +++ .../patients/DischargedPatientPage.dart | 318 ++++++++++++++++++ .../patients/insurance_approvals_details.dart | 1 + .../profile/note/progress_note_screen.dart | 5 +- .../profile/patient_profile_screen.dart | 5 + lib/widgets/doctor/doctor_reply_widget.dart | 2 +- .../profile/PatientProfileButton.dart | 5 +- ...ent-profile-header-new-design-app-bar.dart | 13 + .../patient-profile-header-new-design.dart | 4 +- ..._profile_header_with_appointment_card.dart | 13 + ..._header_with_appointment_card_app_bar.dart | 13 + ...rofile_medical_info_widget_in_patient.dart | 4 +- 20 files changed, 789 insertions(+), 17 deletions(-) create mode 100644 lib/core/model/DischargeReferralPatient.dart create mode 100644 lib/core/service/DischargedPatientService.dart create mode 100644 lib/core/viewModel/DischargedPatientViewModel.dart create mode 100644 lib/screens/patients/DischargedPatientPage.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 2e8690a0..7a9b7d75 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -240,6 +240,8 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; +const GET_MY_DISCHARGE_PATIENT = "/Services/DoctorApplication.svc/REST/GtMyDischargePatient"; + const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; diff --git a/lib/core/model/DischargeReferralPatient.dart b/lib/core/model/DischargeReferralPatient.dart new file mode 100644 index 00000000..44d22bfc --- /dev/null +++ b/lib/core/model/DischargeReferralPatient.dart @@ -0,0 +1,216 @@ +class DischargeReferralPatient { + dynamic rowID; + int projectID; + int lineItemNo; + int doctorID; + int patientID; + String doctorName; + dynamic doctorNameN; + String firstName; + String middleName; + String lastName; + dynamic firstNameN; + dynamic middleNameN; + dynamic lastNameN; + int gender; + String dateofBirth; + String mobileNumber; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomID; + String bedID; + dynamic nursingStationID; + dynamic description; + String nationalityName; + dynamic nationalityNameN; + int referralDoctor; + int referringDoctor; + int referralClinic; + int referringClinic; + int referralStatus; + String referralDate; + String referringDoctorRemarks; + String referredDoctorRemarks; + String referralResponseOn; + int priority; + int frequency; + String mAXResponseTime; + String dischargeDate; + dynamic clinicID; + String age; + String clinicDescription; + String frequencyDescription; + String genderDescription; + bool isDoctorLate; + bool isDoctorResponse; + String nursingStationName; + String priorityDescription; + String referringClinicDescription; + String referringDoctorName; + + DischargeReferralPatient( + {this.rowID, + this.projectID, + this.lineItemNo, + this.doctorID, + this.patientID, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomID, + this.bedID, + this.nursingStationID, + this.description, + this.nationalityName, + this.nationalityNameN, + this.referralDoctor, + this.referringDoctor, + this.referralClinic, + this.referringClinic, + this.referralStatus, + this.referralDate, + this.referringDoctorRemarks, + this.referredDoctorRemarks, + this.referralResponseOn, + this.priority, + this.frequency, + this.mAXResponseTime, + this.dischargeDate, + this.clinicID, + this.age, + this.clinicDescription, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nursingStationName, + this.priorityDescription, + this.referringClinicDescription, + this.referringDoctorName}); + + DischargeReferralPatient.fromJson(Map json) { + rowID = json['RowID']; + projectID = json['ProjectID']; + lineItemNo = json['LineItemNo']; + doctorID = json['DoctorID']; + patientID = json['PatientID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + mobileNumber = json['MobileNumber']; + emailAddress = json['EmailAddress']; + patientIdentificationNo = json['PatientIdentificationNo']; + patientType = json['PatientType']; + admissionNo = json['AdmissionNo']; + admissionDate = json['AdmissionDate']; + roomID = json['RoomID']; + bedID = json['BedID']; + nursingStationID = json['NursingStationID']; + description = json['Description']; + nationalityName = json['NationalityName']; + nationalityNameN = json['NationalityNameN']; + referralDoctor = json['ReferralDoctor']; + referringDoctor = json['ReferringDoctor']; + referralClinic = json['ReferralClinic']; + referringClinic = json['ReferringClinic']; + referralStatus = json['ReferralStatus']; + referralDate = json['ReferralDate']; + referringDoctorRemarks = json['ReferringDoctorRemarks']; + referredDoctorRemarks = json['ReferredDoctorRemarks']; + referralResponseOn = json['ReferralResponseOn']; + priority = json['Priority']; + frequency = json['Frequency']; + mAXResponseTime = json['MAXResponseTime']; + dischargeDate = json['DischargeDate']; + clinicID = json['ClinicID']; + age = json['Age']; + clinicDescription = json['ClinicDescription']; + frequencyDescription = json['FrequencyDescription']; + genderDescription = json['GenderDescription']; + isDoctorLate = json['IsDoctorLate']; + isDoctorResponse = json['IsDoctorResponse']; + nursingStationName = json['NursingStationName']; + priorityDescription = json['PriorityDescription']; + referringClinicDescription = json['ReferringClinicDescription']; + referringDoctorName = json['ReferringDoctorName']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ProjectID'] = this.projectID; + data['LineItemNo'] = this.lineItemNo; + data['DoctorID'] = this.doctorID; + data['PatientID'] = this.patientID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['Gender'] = this.gender; + data['DateofBirth'] = this.dateofBirth; + data['MobileNumber'] = this.mobileNumber; + data['EmailAddress'] = this.emailAddress; + data['PatientIdentificationNo'] = this.patientIdentificationNo; + data['PatientType'] = this.patientType; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionDate'] = this.admissionDate; + data['RoomID'] = this.roomID; + data['BedID'] = this.bedID; + data['NursingStationID'] = this.nursingStationID; + data['Description'] = this.description; + data['NationalityName'] = this.nationalityName; + data['NationalityNameN'] = this.nationalityNameN; + data['ReferralDoctor'] = this.referralDoctor; + data['ReferringDoctor'] = this.referringDoctor; + data['ReferralClinic'] = this.referralClinic; + data['ReferringClinic'] = this.referringClinic; + data['ReferralStatus'] = this.referralStatus; + data['ReferralDate'] = this.referralDate; + data['ReferringDoctorRemarks'] = this.referringDoctorRemarks; + data['ReferredDoctorRemarks'] = this.referredDoctorRemarks; + data['ReferralResponseOn'] = this.referralResponseOn; + data['Priority'] = this.priority; + data['Frequency'] = this.frequency; + data['MAXResponseTime'] = this.mAXResponseTime; + data['DischargeDate'] = this.dischargeDate; + data['ClinicID'] = this.clinicID; + data['Age'] = this.age; + data['ClinicDescription'] = this.clinicDescription; + data['FrequencyDescription'] = this.frequencyDescription; + data['GenderDescription'] = this.genderDescription; + data['IsDoctorLate'] = this.isDoctorLate; + data['IsDoctorResponse'] = this.isDoctorResponse; + data['NursingStationName'] = this.nursingStationName; + data['PriorityDescription'] = this.priorityDescription; + data['ReferringClinicDescription'] = this.referringClinicDescription; + data['ReferringDoctorName'] = this.referringDoctorName; + return data; + } +} diff --git a/lib/core/service/DischargedPatientService.dart b/lib/core/service/DischargedPatientService.dart new file mode 100644 index 00000000..5eb0fabc --- /dev/null +++ b/lib/core/service/DischargedPatientService.dart @@ -0,0 +1,76 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/DischargeReferralPatient.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class DischargedPatientService extends BaseService { + List myDischargedPatients = List(); + + List myDischargeReferralPatients = List(); + + Future getDischargedPatient() async { + hasError = false; + Map body = Map(); + await getDoctorProfile(); + body['DoctorID'] = doctorProfile.doctorID; + body['FirstName'] = "0"; + body['MiddleName'] = "0"; + body['LastName'] = "0"; + body['PatientMobileNumber'] = "0"; + body['PatientIdentificationID'] = "0"; + body['PatientID'] = 0; + body['From'] = "0"; + body['To'] = "0"; + body['stamp'] = DateTime.now().toIso8601String(); + body['IsLoginForDoctorApp'] = true; + body['IPAdress'] = "11.11.11.11"; + body['PatientOutSA'] = false; + body['PatientTypeID'] = 1; + hasError = false; + myDischargedPatients.clear(); + await baseAppClient.post(GET_MY_DISCHARGE_PATIENT, + onSuccess: (dynamic response, int statusCode) { + if (response['List_MyDischargePatient'] != null) { + response['List_MyDischargePatient'].forEach((v) { + myDischargedPatients.add(PatiantInformtion.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future gtMyDischargeReferralPatient() async { + hasError = false; + Map body = Map(); + await getDoctorProfile(); + body['DoctorID'] = doctorProfile.doctorID; + body['FirstName'] = "0"; + body['MiddleName'] = "0"; + body['LastName'] = "0"; + body['PatientMobileNumber'] = "0"; + body['PatientIdentificationID'] = "0"; + body['PatientID'] = 0; + body['From'] = "0"; + body['To'] = "0"; + body['stamp'] = DateTime.now().toIso8601String(); + body['IsLoginForDoctorApp'] = true; + body['IPAdress'] = "11.11.11.11"; + body['PatientOutSA'] = false; + body['PatientTypeID'] = 1; + hasError = false; + myDischargeReferralPatients.clear(); + await baseAppClient.post(GET_MY_DISCHARGE_PATIENT, + onSuccess: (dynamic response, int statusCode) { + if (response['List_MyDischargeReferralPatient'] != null) { + response['List_MyDischargeReferralPatient'].forEach((v) { + myDischargeReferralPatients.add(DischargeReferralPatient.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/MyReferralPatientService.dart b/lib/core/service/MyReferralPatientService.dart index ae1564fd..f58cea48 100644 --- a/lib/core/service/MyReferralPatientService.dart +++ b/lib/core/service/MyReferralPatientService.dart @@ -19,7 +19,7 @@ class MyReferralInPatientService extends BaseService { body['PatientID'] = 0; body['From'] = "0"; body['To'] = "0"; - body['stamp'] = "2021-04-23T15:03:34.189Z";//DateTime.now().toIso8601String(); + body['stamp'] = DateTime.now().toIso8601String(); body['IsLoginForDoctorApp'] = true; body['IPAdress'] = "11.11.11.11"; body['PatientOutSA'] = false; diff --git a/lib/core/service/referral_patient_service.dart b/lib/core/service/referral_patient_service.dart index e3ca6fae..9fc163bd 100644 --- a/lib/core/service/referral_patient_service.dart +++ b/lib/core/service/referral_patient_service.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; class ReferralPatientService extends BaseService { @@ -11,9 +10,6 @@ class ReferralPatientService extends BaseService { List get listMyReferralPatientModel => _listMyReferralPatientModel; - Helpers helpers = Helpers(); - - RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); diff --git a/lib/core/viewModel/DischargedPatientViewModel.dart b/lib/core/viewModel/DischargedPatientViewModel.dart new file mode 100644 index 00000000..76d7e40a --- /dev/null +++ b/lib/core/viewModel/DischargedPatientViewModel.dart @@ -0,0 +1,69 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/DischargeReferralPatient.dart'; +import 'package:doctor_app_flutter/core/service/DischargedPatientService.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class DischargedPatientViewModel extends BaseViewModel { + DischargedPatientService _dischargedPatientService = + locator(); + + List get myDischargedPatient => + _dischargedPatientService.myDischargedPatients; + + List get myDischargeReferralPatient => + _dischargedPatientService.myDischargeReferralPatients; + List filterData = []; + + searchData(String str) { + // this.responseModelList = this.responseModelList2; + // var strExist = str.length > 0 ? true : false; + // if (strExist) { + // List filterData = []; + // + // for (var i = 0; i < responseModelList2.length; i++) { + // String firstName = responseModelList[i].firstName.toUpperCase(); + // String lastName = responseModelList[i].lastName.toUpperCase(); + // String mobile = responseModelList[i].mobileNumber.toUpperCase(); + // String patientID = responseModelList[i].patientId.toString(); + // + // if (firstName.contains(str.toUpperCase()) || + // lastName.contains(str.toUpperCase()) || + // mobile.contains(str) || + // patientID.contains(str)) { + // filterData.add(responseModelList[i]); + // } + // } + // + // // setState(() { + // // this.responseModelList = filterData; + // // }); + // } else { + // filterData = myDischargedPatient; + // notifyListeners(); + // } + } + + + Future getDischargedPatient() async { + setState(ViewState.Busy); + await _dischargedPatientService.getDischargedPatient(); + if (_dischargedPatientService.hasError) { + error = _dischargedPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future gtMyDischargeReferralPatient() async { + setState(ViewState.Busy); + await _dischargedPatientService.gtMyDischargeReferralPatient(); + if (_dischargedPatientService.hasError) { + error = _dischargedPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 2890a38e..a639bed2 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_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/DischargedPatientService.dart'; import 'core/service/InsuranceCardService.dart'; import 'core/service/MyReferralPatientService.dart'; import 'core/service/PatientMuseService.dart'; @@ -31,6 +32,7 @@ import 'core/service/radiology_service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; +import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; @@ -76,6 +78,7 @@ void setupLocator() { locator.registerLazySingleton(() => PrescriptionsService()); locator.registerLazySingleton(() => ReferralService()); locator.registerLazySingleton(() => MyReferralInPatientService()); + locator.registerLazySingleton(() => DischargedPatientService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -100,4 +103,5 @@ void setupLocator() { locator.registerFactory(() => InsuranceViewModel()); locator.registerFactory(() => RadiologyViewModel()); locator.registerFactory(() => PrescriptionsViewModel()); + locator.registerFactory(() => DischargedPatientViewModel()); } diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index cf266faa..a794cf29 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -11,8 +11,8 @@ class PatiantInformtion { String arrivedOn; int clinicGroupId; String companyName; - Null dischargeStatus; - Null doctorDetails; + dynamic dischargeStatus; + dynamic doctorDetails; int doctorId; String endTime; int episodeNo; @@ -60,6 +60,7 @@ class PatiantInformtion { int patientStatusType; int visitTypeId; String startTimes; + String dischargeDate; PatiantInformtion( {this.patientDetails, this.projectId, @@ -119,7 +120,7 @@ class PatiantInformtion { this.nationalityFlagURL, this.patientStatusType, this.visitTypeId, - this.startTimes}); + this.startTimes,this.dischargeDate}); factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( @@ -176,7 +177,7 @@ class PatiantInformtion { appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], appointmentType: json['appointmentType'], appointmentTypeId: json['appointmentTypeId']?? json['appointmentTypeid'], - arrivedOn: json['arrivedOn'] ?? json['ArrivedOn'], + arrivedOn: json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'], clinicGroupId: json['clinicGroupId'], companyName: json['companyName'], dischargeStatus: json['dischargeStatus'], @@ -195,5 +196,6 @@ class PatiantInformtion { json['patientStatusType'] ?? json['PatientStatusType'], visitTypeId: json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'], startTimes: json['StartTime'] ?? json['StartTime'], + dischargeDate: json['DischargeDate'] , ); } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 0e5e87da..77dc19c4 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -13,6 +13,7 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/DischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -623,6 +624,45 @@ class _HomeScreenState extends State { ); }, ), + HomePageCard( + color: Colors.red[800], + margin: EdgeInsets.all(5), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.referral_1, + size: 35, + color: Colors.white, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + 'DischargedPatient', + color: Colors.white, + textAlign: TextAlign.start, + fontSize: 15, + )) + ], + ), + hasBorder: false, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + DischargedPatient(), + // MyReferredPatient(), + ), + ); + }, + ), ])), // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart new file mode 100644 index 00000000..6cc558d8 --- /dev/null +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -0,0 +1,318 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/DischargedPatientViewModel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../../routes.dart'; + +class DischargedPatient extends StatefulWidget { + @override + _DischargedPatientState createState() => _DischargedPatientState(); +} + +class _DischargedPatientState extends State { + final _controller = TextEditingController(); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getDischargedPatient(), + builder: (_, model, w) => AppScaffold( + appBarTitle: 'Discharged Patient', + backgroundColor: Colors.grey[200], + isShowAppBar: true, + baseViewModel: model, + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 12,), + Container( + width: double.maxFinite, + height: 75, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: Color(0xffCCCCCC), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, top: 10), + child: AppText( + TranslationBase.of( + context) + .searchPatientName, + fontSize: 13, + )), + AppTextFormField( + // focusNode: focusProject, + controller: _controller, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + DoctorApp.filter_1, + color: Colors.black, + ), + iconSize: 20, + padding: + EdgeInsets.only( + bottom: 30), + ), + onChanged: (String str) { + //this.searchData(str); + }), + ])), + ...List.generate( + model.myDischargedPatient.length, + (index) => InkWell( + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": model.myDischargedPatient[index], + "patientType": "1", + "isSearch": false, + "isInpatient":true, + "isDischargedPatient":true + }); + + }, + child: Container( + width: double.maxFinite, + margin: EdgeInsets.all(8), + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + ), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row(children: [ + Container( + width: 170, + child: AppText( + (Helpers.capitalize(model + .myDischargedPatient[index] + .firstName) + + " " + + Helpers.capitalize(model + .myDischargedPatient[index] + .lastName)), + fontSize: 16, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + textOverflow: TextOverflow.ellipsis, + ), + ), + model.myDischargedPatient[index].gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + Row( + children: [ + AppText( + model.myDischargedPatient[index].nationalityName != null + ? model.myDischargedPatient[index].nationalityName.trim() + : model.myDischargedPatient[index].nationality != null + ? model.myDischargedPatient[index].nationality.trim() + : model.myDischargedPatient[index].nationalityId != null + ? model.myDischargedPatient[index].nationalityId + : "", + fontWeight: FontWeight.bold, + fontSize: 14, + textOverflow: TextOverflow.ellipsis, + ), + model.myDischargedPatient[index] + .nationality != + null || + model.myDischargedPatient[index] + .nationalityId != + null + ? ClipRRect( + borderRadius: + BorderRadius.circular(20.0), + child: Image.network( + model.myDischargedPatient[index].nationalityFlagURL != null ? + model.myDischargedPatient[index].nationalityFlagURL + : '', + height: 25, + width: 30, + errorBuilder: + (BuildContext context, + Object exception, + StackTrace stackTrace) { + return AppText( + '', + fontSize: 10, + ); + }, + )) + : SizedBox() + ], + ) + ], + )), + Row( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + model.myDischargedPatient[index].gender == + 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + ], + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .fileNumber, + style: TextStyle( + fontSize: 14, + fontFamily: 'Poppins')), + new TextSpan( + text: model + .myDischargedPatient[index] + .patientId + .toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: model.myDischargedPatient[index].admissionDate == null ? "" : + TranslationBase.of(context).admissionDate + " : ", + style: TextStyle(fontSize: 14)), + new TextSpan( + text: model.myDischargedPatient[index].admissionDate == null ? "" + : "${DateUtils.convertDateFromServerFormat(model.myDischargedPatient[index].admissionDate.toString(), 'yyyy-MM-dd')}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15)), + ], + ), + ), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: model.myDischargedPatient[index].dischargeDate == null ? "" + : "Discharge Date : ", + style: TextStyle(fontSize: 14)), + new TextSpan( + text: model.myDischargedPatient[index].dischargeDate == null ? "" + : "${DateUtils.convertDateFromServerFormat(model.myDischargedPatient[index].dischargeDate.toString(), 'yyyy-MM-dd')}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15)), + ], + ), + ), + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).numOfDays}: ", + fontSize: 14,fontWeight: FontWeight.w300, + ), + AppText( + "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(model.myDischargedPatient[index].admissionDate)).inDays + 1}", + fontSize: 15, + fontWeight: FontWeight.w700), + ], + ), + ], + ), + ) + ], + ) + ], + ), + ), + ), + ) + ], + ), + ), + ), + ), + ); + } + + +} diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index ee2fd12d..ccdd9b9f 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -630,6 +630,7 @@ class _InsuranceApprovalsDetailsState extends State { 'Exp on: ', color: Colors.grey[500], ), + if(model.insuranceApproval[indexInsurance].expiryDate!=null) AppText( '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate), isArabic: projectViewModel.isArabic)}', color: Colors.black, diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index b6b9c195..c4500824 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -37,7 +37,7 @@ class _ProgressNoteState extends State { var filteredNotesList; final _controller = TextEditingController(); var _isInit = true; - + bool isDischargedPatient = false; getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; @@ -63,6 +63,8 @@ class _ProgressNoteState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String arrivalType = routeArgs['arrivalType']; + if(routeArgs.containsKey('isDischargedPatient')) + isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => getProgressNoteList(context, model), builder: (_, model, w) => AppScaffold( @@ -78,6 +80,7 @@ class _ProgressNoteState extends State { color: Colors.grey[200], child: Column( children: [ + if(!isDischargedPatient) AddNewOrder( onTap: () { Navigator.push( context, diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index fd4c5719..d4f5110f 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -27,6 +27,7 @@ class PatientProfileScreen extends StatelessWidget { PatiantInformtion patient; bool isFromSearch = false; bool isInpatient = false; + bool isDischargedPatient = false; @override Widget build(BuildContext context) { @@ -44,6 +45,9 @@ class PatientProfileScreen extends StatelessWidget { if (routeArgs.containsKey("isInpatient")) { isInpatient = routeArgs['isInpatient']; } + if (routeArgs.containsKey("isDischargedPatient")) { + isDischargedPatient = routeArgs['isDischargedPatient']; + } return BaseView( builder: (_, patientViewModel, w) => AppScaffold( @@ -77,6 +81,7 @@ class PatientProfileScreen extends StatelessWidget { from: from, to: to, isInpatient:isInpatient, + isDischargedPatient: isDischargedPatient, ) : isFromSearch ? ProfileMedicalInfoWidgetSearch( diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 8ad3a071..474bad7b 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -246,7 +246,7 @@ class _DoctorReplyWidgetState extends State { style: TextStyle(fontSize: 14, fontFamily: 'Poppins', color: Color(0xFF575757),fontWeight: FontWeight.bold)), new TextSpan( - text: widget.reply.remarks.trim(), + text: widget.reply?.remarks?.trim()??'', style: TextStyle( fontFamily: 'Poppins', color: Color(0xFF575757), diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index 6267e522..8931972c 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -20,7 +20,7 @@ class PatientProfileButton extends StatelessWidget { final bool isDisable; final bool isLoading; final Function onTap; - + final bool isDischargedPatient; PatientProfileButton( {Key key, this.patient, @@ -35,7 +35,7 @@ class PatientProfileButton extends StatelessWidget { this.isLoading = false, this.from, this.to, - this.isInPatient = false, + this.isInPatient = false, this.isDischargedPatient=false, }) : super(key: key); @@ -132,6 +132,7 @@ class PatientProfileButton extends StatelessWidget { 'patientType': patientType, 'arrivalType': arrivalType, 'isInpatient': isInPatient, + 'isDischargedPatient;': isDischargedPatient, }); } } diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index 93fe4d68..48454af4 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; +import 'package:url_launcher/url_launcher.dart'; class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with PreferredSizeWidget { @@ -72,6 +73,18 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget DoctorApp.female_1, color: Colors.pink, ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" + patient.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ), ]), ), Row(children: [ diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart index c0698f16..27984614 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design.dart @@ -139,9 +139,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { fontWeight: FontWeight.w600, ) : AppText( - DateUtils.convertStringToDateFormat( - patient.arrivedOn, - 'MM-dd-yyyy HH:mm'), + DateUtils.getDayMonthYearDateFormatted(DateUtils.convertStringToDate(patient.arrivedOn)), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ) diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart index 4726a018..291530e9 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart @@ -12,6 +12,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'large_avatar.dart'; @@ -91,6 +92,18 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { DoctorApp.female_1, color: Colors.pink, ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" + patient.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ) ]), ), Row(children: [ diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart index 5de6299c..bb9fc88d 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart @@ -12,6 +12,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'large_avatar.dart'; @@ -99,6 +100,18 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget DoctorApp.female_1, color: Colors.pink, ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" + patient.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ) ]), ), Row(children: [ diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart index 5fc9cf19..62941d86 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart @@ -24,6 +24,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { final String patientType; final String arrivalType; final bool isInpatient; + final bool isDischargedPatient; @@ -33,7 +34,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { this.patientType, this.arrivalType, this.from, - this.to, this.isInpatient}); + this.to, this.isInpatient, this.isDischargedPatient = false}); @override Widget build(BuildContext context) { @@ -94,6 +95,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patientType: patientType, arrivalType: arrivalType, route: PROGRESS_NOTE, + isDischargedPatient: isDischargedPatient, nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'patient/Progress_notes.png'),