From 4b32487540717ba182e849b1629bdd84ea4bd9ab Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 15 Apr 2021 15:06:58 +0300 Subject: [PATCH] referral design and service changes --- .../patient-doctor-referral-service.dart | 2 +- .../service/referred_patient_service.dart | 27 - .../viewModel/patient-referral-viewmodel.dart | 14 +- lib/core/viewModel/referred_view_model.dart | 9 - .../my_referred_patient_model.dart | 464 ++++++++++-------- lib/screens/dashboard_screen.dart | 12 - .../doctor/my_referred_patient_screen.dart | 54 -- .../doctor/patient_arrival_screen.dart | 6 - .../search_medicine_patient_screen.dart | 9 - .../referral/patient_referral_screen.dart | 2 - .../referral/referred-patient-screen.dart | 49 +- .../doctor/my_referred_patient_widget.dart | 311 ------------ 12 files changed, 278 insertions(+), 681 deletions(-) delete mode 100644 lib/screens/doctor/my_referred_patient_screen.dart delete mode 100644 lib/widgets/doctor/my_referred_patient_widget.dart diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 62ebcb06..1677bbce 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -145,7 +145,7 @@ class PatientReferralService extends LookupService { MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); if (doctorProfile != null) { item.isReferralDoctorSameBranch = - doctorProfile.projectID == item.projectId; + doctorProfile.projectID == item.projectID; } else { item.isReferralDoctorSameBranch = false; } diff --git a/lib/core/service/referred_patient_service.dart b/lib/core/service/referred_patient_service.dart index 7285d904..20decbf1 100644 --- a/lib/core/service/referred_patient_service.dart +++ b/lib/core/service/referred_patient_service.dart @@ -34,31 +34,4 @@ class ReferredPatientService extends BaseService { ); } - Future verify(MyReferredPatientModel model) async { - _verifyreferraldoctorremarks.patientID = model.projectId; - _verifyreferraldoctorremarks.admissionNo = model.admissionNo; - _verifyreferraldoctorremarks.lineItemNo = model.lineItemNo; - _verifyreferraldoctorremarks.referredDoctorRemarks = - model.referredDoctorRemarks; - _verifyreferraldoctorremarks.referringDoctor = model.referringDoctor; - _verifyreferraldoctorremarks.firstName = model.firstName; - _verifyreferraldoctorremarks.middleName = model.middleName; - _verifyreferraldoctorremarks.lastName = model.lastName; - _verifyreferraldoctorremarks.patientMobileNumber = model.mobileNumber; - _verifyreferraldoctorremarks.patientIdentificationID = - model.patientIdentificationNo; - - await baseAppClient.post( - GET_MY_REFERRED_PATIENT, - onSuccess: (dynamic response, int statusCode) { - listMyReferredPatientModel[listMyReferredPatientModel.indexOf(model)] = - model; - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: _verifyreferraldoctorremarks.toJson(), - ); - } } diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 2a7f921a..3c3a5b2f 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -176,22 +176,18 @@ class PatientReferralViewModel extends BaseViewModel { } } - /* - * model - .getPatientArrivalList()*/ - String getReferralStatusNameByCode(int statusCode, BuildContext context) { switch (statusCode) { case 1: - return TranslationBase.of(context).referralStatusHold; + return TranslationBase.of(context).pending/*referralStatusHold*/; case 2: - return TranslationBase.of(context).referralStatusActive; + return TranslationBase.of(context).accepted/*referralStatusActive*/; case 4: - return TranslationBase.of(context).referralStatusCancelled; + return TranslationBase.of(context).rejected/*referralStatusCancelled*/; case 46: - return TranslationBase.of(context).referralStatusCompleted; + return TranslationBase.of(context).accepted/*referralStatusCompleted*/; case 63: - return TranslationBase.of(context).referralStatusNotSeen; + return TranslationBase.of(context).rejected/*referralStatusNotSeen*/; default: return "-"; } diff --git a/lib/core/viewModel/referred_view_model.dart b/lib/core/viewModel/referred_view_model.dart index b5e3ecdc..2aa996f6 100644 --- a/lib/core/viewModel/referred_view_model.dart +++ b/lib/core/viewModel/referred_view_model.dart @@ -20,13 +20,4 @@ class ReferredPatientViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future verify(MyReferredPatientModel model) async { - setState(ViewState.BusyLocal); - await _referralPatientService.verify(model); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } } diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 850c29cb..f7d48c60 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -1,223 +1,259 @@ - import 'dart:convert'; import 'package:doctor_app_flutter/util/helpers.dart'; -MyReferredPatientModel myReferredPatientModelFromJson(String str) => MyReferredPatientModel.fromJson(json.decode(str)); - -String myReferredPatientModelToJson(MyReferredPatientModel data) => json.encode(data.toJson()); - class MyReferredPatientModel { - MyReferredPatientModel({ - 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.clinicDescription, - this.clinicDescriptionN, - 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.age, - this.frequencyDescription, - this.genderDescription, - this.isDoctorLate, - this.isDoctorResponse, - this.nursingStationName, - this.priorityDescription, - this.referralClinicDescription, - this.referralDoctorName, - this.isReferralDoctorSameBranch, - }); + String rowID; + int projectID; + int lineItemNo; + int doctorID; + int patientID; + String doctorName; + String doctorNameN; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int gender; + String dateofBirth; + String mobileNumber; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomID; + String bedID; + String nursingStationID; + String description; + String nationalityName; + String nationalityNameN; + String clinicDescription; + String clinicDescriptionN; + int referralDoctor; + int referringDoctor; + int referralClinic; + int referringClinic; + int referralStatus; + String referralDate; + String referringDoctorRemarks; + String referredDoctorRemarks; + String referralResponseOn; + int priority; + int frequency; + String mAXResponseTime; + int episodeID; + int appointmentNo; + String appointmentDate; + int appointmentType; + int patientMRN; + String createdOn; + int clinicID; + String nationalityID; + String age; + String doctorImageURL; + String frequencyDescription; + String genderDescription; + bool isDoctorLate; + bool isDoctorResponse; + String nationalityFlagURL; + String nursingStationName; + String priorityDescription; + String referringClinicDescription; + String referringDoctorName; + bool isReferralDoctorSameBranch; - 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; - String clinicDescription; - dynamic clinicDescriptionN; - int referralDoctor; - int referringDoctor; - int referralClinic; - int referringClinic; - int referralStatus; - String referralDate; - String referringDoctorRemarks; - String referredDoctorRemarks; - String referralResponseOn; - int priority; - int frequency; - DateTime maxResponseTime; - dynamic dischargeDate; - String age; - String frequencyDescription; - String genderDescription; - bool isDoctorLate; - bool isDoctorResponse; - String nursingStationName; - String priorityDescription; - String referralClinicDescription; - String referralDoctorName; - bool isReferralDoctorSameBranch; + MyReferredPatientModel({ + 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.clinicDescription, + this.clinicDescriptionN, + 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.episodeID, + this.appointmentNo, + this.appointmentDate, + this.appointmentType, + this.patientMRN, + this.createdOn, + this.clinicID, + this.nationalityID, + this.age, + this.doctorImageURL, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nationalityFlagURL, + this.nursingStationName, + this.priorityDescription, + this.referringClinicDescription, + this.referringDoctorName, + this.isReferralDoctorSameBranch, + }); - factory MyReferredPatientModel.fromJson(Map json) => MyReferredPatientModel( - 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"], - clinicDescription: json["ClinicDescription"], - clinicDescriptionN: json["ClinicDescriptionN"], - 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: Helpers.convertStringToDate(json['MAXResponseTime']),//json["MAXResponseTime"], - dischargeDate: json["DischargeDate"], - age: json["Age"], - frequencyDescription: json["FrequencyDescription"], - genderDescription: json["GenderDescription"], - isDoctorLate: json["IsDoctorLate"], - isDoctorResponse: json["IsDoctorResponse"], - nursingStationName: json["NursingStationName"], - priorityDescription: json["PriorityDescription"], - referralClinicDescription: json["ReferralClinicDescription"], - referralDoctorName: json["ReferralDoctorName"], - ); + MyReferredPatientModel.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']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + 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']; + episodeID = json['EpisodeID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = json['AppointmentDate']; + appointmentType = json['AppointmentType']; + patientMRN = json['PatientMRN']; + createdOn = json['CreatedOn']; + clinicID = json['ClinicID']; + nationalityID = json['NationalityID']; + age = json['Age']; + doctorImageURL = json['DoctorImageURL']; + frequencyDescription = json['FrequencyDescription']; + genderDescription = json['GenderDescription']; + isDoctorLate = json['IsDoctorLate']; + isDoctorResponse = json['IsDoctorResponse']; + nationalityFlagURL = json['NationalityFlagURL']; + nursingStationName = json['NursingStationName']; + priorityDescription = json['PriorityDescription']; + referringClinicDescription = json['ReferringClinicDescription']; + referringDoctorName = json['ReferringDoctorName']; + } - Map toJson() => { - "ProjectID": projectId, - "LineItemNo": lineItemNo, - "DoctorID": doctorId, - "PatientID": patientId, - "DoctorName": doctorName, - "DoctorNameN": doctorNameN, - "FirstName": firstName, - "MiddleName": middleName, - "LastName": lastName, - "FirstNameN": firstNameN, - "MiddleNameN": middleNameN, - "LastNameN": lastNameN, - "Gender": gender, - "DateofBirth": dateofBirth, - "MobileNumber": mobileNumber, - "EmailAddress": emailAddress, - "PatientIdentificationNo": patientIdentificationNo, - "PatientType": patientType, - "AdmissionNo": admissionNo, - "AdmissionDate": admissionDate, - "RoomID": roomId, - "BedID": bedId, - "NursingStationID": nursingStationId, - "Description": description, - "NationalityName": nationalityName, - "NationalityNameN": nationalityNameN, - "ClinicDescription": clinicDescription, - "ClinicDescriptionN": clinicDescriptionN, - "ReferralDoctor": referralDoctor, - "ReferringDoctor": referringDoctor, - "ReferralClinic": referralClinic, - "ReferringClinic": referringClinic, - "ReferralStatus": referralStatus, - "ReferralDate": referralDate, - "ReferringDoctorRemarks": referringDoctorRemarks, - "ReferredDoctorRemarks": referredDoctorRemarks, - "ReferralResponseOn": referralResponseOn, - "Priority": priority, - "Frequency": frequency, - "MAXResponseTime": maxResponseTime, - "DischargeDate": dischargeDate, - "Age": age, - "FrequencyDescription": frequencyDescription, - "GenderDescription": genderDescription, - "IsDoctorLate": isDoctorLate, - "IsDoctorResponse": isDoctorResponse, - "NursingStationName": nursingStationName, - "PriorityDescription": priorityDescription, - "ReferralClinicDescription": referralClinicDescription, - "ReferralDoctorName": referralDoctorName, - }; + 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['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + 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['EpisodeID'] = this.episodeID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentType'] = this.appointmentType; + data['PatientMRN'] = this.patientMRN; + data['CreatedOn'] = this.createdOn; + data['ClinicID'] = this.clinicID; + data['NationalityID'] = this.nationalityID; + data['Age'] = this.age; + data['DoctorImageURL'] = this.doctorImageURL; + data['FrequencyDescription'] = this.frequencyDescription; + data['GenderDescription'] = this.genderDescription; + data['IsDoctorLate'] = this.isDoctorLate; + data['IsDoctorResponse'] = this.isDoctorResponse; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NursingStationName'] = this.nursingStationName; + data['PriorityDescription'] = this.priorityDescription; + data['ReferringClinicDescription'] = this.referringClinicDescription; + data['ReferringDoctorName'] = this.referringDoctorName; + return data; + } } - diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b0c3bcde..c249c0bc 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -3,9 +3,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:charts_flutter/flutter.dart' as charts; -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'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; @@ -13,12 +11,8 @@ 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/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/doctor/patient_arrival_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; -import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -32,16 +26,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.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'; -import 'doctor/my_referral_patient_screen.dart'; -import 'doctor/my_referred_patient_screen.dart'; -import 'medicine/medicine_search_screen.dart'; -import 'patients/profile/referral/referred-patient-screen.dart'; import '../widgets/shared/rounded_container_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart deleted file mode 100644 index 86e5de53..00000000 --- a/lib/screens/doctor/my_referred_patient_screen.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/referred_view_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/doctor/my_referred_patient_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/shared/app_scaffold_widget.dart'; - -class MyReferredPatient extends StatelessWidget { - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getMyReferredPatient(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - appBarTitle: TranslationBase.of(context).myReferredPatient, - body: model.listMyReferredPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 100, - ), - Container( - child: Column( - //children: referredPatientProvider.listMyReferralPatientModel.map((item) { - children: model.listMyReferredPatientModel - .map((item) { - return MyReferredPatientWidget( - myReferredPatientModel: item, - model: model); - }).toList(), - ), - ), - ], - ), - ], - ), - ), - )); - } -} diff --git a/lib/screens/doctor/patient_arrival_screen.dart b/lib/screens/doctor/patient_arrival_screen.dart index fa2bd11b..d5a254e8 100644 --- a/lib/screens/doctor/patient_arrival_screen.dart +++ b/lib/screens/doctor/patient_arrival_screen.dart @@ -1,12 +1,6 @@ import 'dart:ui'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; -import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; -import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; diff --git a/lib/screens/medicine/search_medicine_patient_screen.dart b/lib/screens/medicine/search_medicine_patient_screen.dart index 305ad1d2..5e691e09 100644 --- a/lib/screens/medicine/search_medicine_patient_screen.dart +++ b/lib/screens/medicine/search_medicine_patient_screen.dart @@ -1,15 +1,6 @@ import 'dart:ui'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; -import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; -import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; -import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart index 1935bc46..ef18866c 100644 --- a/lib/screens/patients/profile/referral/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -1,6 +1,4 @@ import 'dart:ui'; -import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; -import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 0c8732a9..0bacb1d8 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -51,33 +51,28 @@ class ReferredPatientScreen extends StatelessWidget { ...List.generate( model.listMyReferredPatientModel.length, (index) => - Container() /*PatientReferralItemWidget( - "${model.getReferredPatientItem(index).patientId}", - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - referralStatus: - "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", - isReferredTo: true, - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - referralDoctorName: model - .getReferredPatientItem(index) - .referralDoctorName, - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - referredOn: model - .getReferredPatientItem(index) - .referralDate != - null - ? DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy") - : null, - )*/ - , + PatientReferralItemWidget( + referralStatus: "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", + patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: model.getReferredPatientItem(index).gender, + referredDate: DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy"), + referredTime: " ", + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model.getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: + model.getReferredPatientItem(index).referringDoctorRemarks, + nationality: model.getReferredPatientItem(index) + .nationalityName, + nationalityFlag: + model.getReferredPatientItem(index).nationalityFlagURL, + doctorAvatar: + model.getReferredPatientItem(index).doctorImageURL, + referralDoctorName: "${model.getReferredPatientItem(index).referringDoctorName}(${model.getReferredPatientItem(index).referringClinicDescription})", + clinicDescription: null, + ), ), ], ), diff --git a/lib/widgets/doctor/my_referred_patient_widget.dart b/lib/widgets/doctor/my_referred_patient_widget.dart deleted file mode 100644 index 88063f93..00000000 --- a/lib/widgets/doctor/my_referred_patient_widget.dart +++ /dev/null @@ -1,311 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/referred_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_button.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/cupertino.dart'; -import 'package:flutter/material.dart'; - -class MyReferredPatientWidget extends StatefulWidget { - final MyReferredPatientModel myReferredPatientModel; - final ReferredPatientViewModel model; - - MyReferredPatientWidget({Key key, this.myReferredPatientModel, this.model}); - - @override - _MyReferredPatientWidgetState createState() => - _MyReferredPatientWidgetState(); -} - -class _MyReferredPatientWidgetState extends State { - bool _showDetails = false; - bool _isLoading = false; - TextEditingController answerController; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 10), - padding: EdgeInsets.only(left: 0, top: 8, right: 0, bottom: 0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.fromBorderSide(BorderSide( - color: Color(0xffCCCCCC), - width: 2, - )), - color: Color(0xffffffff), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - '${widget.myReferredPatientModel.firstName} ${widget.myReferredPatientModel.lastName}', - fontSize: 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - InkWell( - onTap: () { - setState(() { - _showDetails = !_showDetails; - }); - }, - child: Image.asset( - "assets/images/ic_circle_arrow.png", - width: 25, - height: 25, - color: Colors.black, - ), - ), - ], - ), - ), - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - Divider( - color: Color(0xFF000000), - height: 0.5, - ), - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 0.5), - ), - children: [ - TableRow(children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - decoration: BoxDecoration(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferredPatientModel.patientId}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - margin: EdgeInsets.only( - left: 4, top: 2.5, right: 2.5, bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).referralDoctor, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - Texts( - widget.myReferredPatientModel - .referralDoctorName, - maxLength: 80, - readMore: true, - ), - ], - ), - ), - ]), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).referringClinic, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferredPatientModel.referralClinicDescription}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - margin: EdgeInsets.only( - left: 4, top: 2.5, right: 2.5, bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).frequency, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.myReferredPatientModel - .frequencyDescription, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ) - ], - ), - TableRow(children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).priority, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferredPatientModel.priorityDescription}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - margin: EdgeInsets.only( - left: 4, top: 2.5, right: 2.5, bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).maxResponseTime, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - Helpers.getDateFormatted(widget - .myReferredPatientModel.maxResponseTime), - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ) - ]) - ], - ), - Divider( - color: Color(0xFF000000), - height: 0.5, - ), - SizedBox( - height: 5, - ), - Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).clinicDetailsandRemarks, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - textAlign: TextAlign.start, - ), - SizedBox( - height: 5, - ), - Texts( - '${widget.myReferredPatientModel.referringDoctorRemarks}', - style: "bodyText1", - readMore: true, - textAlign: TextAlign.start, - maxLength: 100), - SizedBox( - height: 5, - ), - AppText( - TranslationBase.of(context).answerSuggestions, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - textAlign: TextAlign.start, - ), - SizedBox( - height: 5, - ), - Texts( - '${widget.myReferredPatientModel.referredDoctorRemarks}', - style: "bodyText1", - readMore: true, - textAlign: TextAlign.start, - maxLength: 100), - ], - ), - ), - SizedBox( - height: 5, - ), - SizedBox(height: 10.0), - Container( - margin: EdgeInsets.all(10), - width: double.infinity, - child: Button( - onTap: () async { - try { - await widget.model - .verify(widget.myReferredPatientModel); - - DrAppToastMsg.showSuccesToast( - 'Verify Successfully'); - } catch (e) { - DrAppToastMsg.showErrorToast(e); - } - }, - title: TranslationBase.of(context).verify, - loading: widget.model.state == ViewState.BusyLocal, - ), - ) - ], - ) - ], - ), - isExpand: _showDetails, - ) - ], - ), - ); - } -}