From 8de50bfe74d52bce001334df8d26b904b6c7cd72 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 4 Aug 2020 14:22:22 +0300 Subject: [PATCH] medical - my doctor and prescription services and pages --- lib/config/config.dart | 15 +- lib/core/enum/filter_type.dart | 1 + lib/core/model/doctor/doctor_profile.dart | 176 ++++++++++ lib/core/model/doctor/doctor_rating.dart | 32 ++ .../doctor/patient_doctor_appointment.dart | 325 ++++++++++++++++++ .../reques_patient_doctor_appointmentt.dart | 76 ++++ .../model/doctor/request_doctor_profile.dart | 72 ++++ .../model/doctor/request_doctor_rating.dart | 52 +++ .../model/prescriptions/Prescriptions.dart | 155 +++++++++ .../prescriptions/prescription_report.dart | 127 +++++++ .../prescriptions/prescriptions_order.dart | 134 ++++++++ .../request_prescription_report.dart | 88 +++++ .../prescriptions/request_prescriptions.dart | 64 ++++ .../request_prescriptions_orders.dart | 52 +++ .../request_send_prescription_email.dart | 112 ++++++ lib/core/service/client/base_app_client.dart | 1 + .../service/medical/my_doctor_service.dart | 102 ++++++ .../medical/prescriptions_service.dart | 149 ++++++++ .../medical/my_doctor_view_model.dart | 97 ++++++ .../medical/prescriptions_view_model.dart | 126 +++++++ lib/locator.dart | 8 + .../MyAppointments/AppointmentDetails.dart | 2 +- lib/pages/landing/landing_page.dart | 5 +- .../medical/doctor/doctor_home_page.dart | 110 ++++++ .../doctor/doctor_information_page.dart | 199 +++++++++++ .../medical/doctor/doctor_profile_page.dart | 181 ++++++++++ ...al_page.dart => medical_profile_page.dart} | 56 +-- .../prescription_details_page.dart | 175 ++++++++++ .../prescription_items_page.dart | 112 ++++++ .../prescriptions/prescriptions_history.dart | 13 + .../prescriptions_home_page.dart | 122 +++++++ .../prescriptions/prescriptions_page.dart | 102 ++++++ lib/widgets/buttons/button.dart | 4 +- .../data_display/medical/doctor_card.dart | 168 +++++---- lib/widgets/others/app_scaffold_widget.dart | 4 +- lib/widgets/others/card_with_bg_widget.dart | 6 +- 36 files changed, 3134 insertions(+), 89 deletions(-) create mode 100644 lib/core/enum/filter_type.dart create mode 100644 lib/core/model/doctor/doctor_profile.dart create mode 100644 lib/core/model/doctor/doctor_rating.dart create mode 100644 lib/core/model/doctor/patient_doctor_appointment.dart create mode 100644 lib/core/model/doctor/reques_patient_doctor_appointmentt.dart create mode 100644 lib/core/model/doctor/request_doctor_profile.dart create mode 100644 lib/core/model/doctor/request_doctor_rating.dart create mode 100644 lib/core/model/prescriptions/Prescriptions.dart create mode 100644 lib/core/model/prescriptions/prescription_report.dart create mode 100644 lib/core/model/prescriptions/prescriptions_order.dart create mode 100644 lib/core/model/prescriptions/request_prescription_report.dart create mode 100644 lib/core/model/prescriptions/request_prescriptions.dart create mode 100644 lib/core/model/prescriptions/request_prescriptions_orders.dart create mode 100644 lib/core/model/prescriptions/request_send_prescription_email.dart create mode 100644 lib/core/service/medical/my_doctor_service.dart create mode 100644 lib/core/service/medical/prescriptions_service.dart create mode 100644 lib/core/viewModels/medical/my_doctor_view_model.dart create mode 100644 lib/core/viewModels/medical/prescriptions_view_model.dart create mode 100644 lib/pages/medical/doctor/doctor_home_page.dart create mode 100644 lib/pages/medical/doctor/doctor_information_page.dart create mode 100644 lib/pages/medical/doctor/doctor_profile_page.dart rename lib/pages/medical/{medical_page.dart => medical_profile_page.dart} (68%) create mode 100644 lib/pages/medical/prescriptions/prescription_details_page.dart create mode 100644 lib/pages/medical/prescriptions/prescription_items_page.dart create mode 100644 lib/pages/medical/prescriptions/prescriptions_history.dart create mode 100644 lib/pages/medical/prescriptions/prescriptions_home_page.dart create mode 100644 lib/pages/medical/prescriptions/prescriptions_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 60e9bbd3..a4e7a415 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -9,8 +9,21 @@ const MAX_SMALL_SCREEN = 660; const BASE_URL = 'https://hmgwebservices.com/Services'; const GET_PROJECT = '/Lists.svc/REST/GetProject'; + +///Doctor +const GET_MY_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_DOCTOR_PROFILE = '/Doctors.svc/REST/GetDocProfiles'; +const GET_DOCTOR_RATING = '/Doctors.svc/REST/dr_GetAvgDoctorRating'; + + +///Prescriptions +const PRESCRIPTIONS = '/Patients.svc/REST/GetPrescriptionApptList'; +const GET_PRESCRIPTIONS_ALL_ORDERS = '/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail'; + //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment -//const BASE_URL = 'https://uat.hmgwebservices.com/'; // UAT Environment +//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment //URL to get clinic list diff --git a/lib/core/enum/filter_type.dart b/lib/core/enum/filter_type.dart new file mode 100644 index 00000000..9da35c43 --- /dev/null +++ b/lib/core/enum/filter_type.dart @@ -0,0 +1 @@ +enum FilterType { Clinic, Hospital } diff --git a/lib/core/model/doctor/doctor_profile.dart b/lib/core/model/doctor/doctor_profile.dart new file mode 100644 index 00000000..9e222e5a --- /dev/null +++ b/lib/core/model/doctor/doctor_profile.dart @@ -0,0 +1,176 @@ +class DoctorProfile { + int doctorID; + String doctorName; + Null doctorNameN; + int clinicID; + String clinicDescription; + Null clinicDescriptionN; + Null licenseExpiry; + int employmentType; + Null setupID; + int projectID; + String projectName; + String nationalityID; + String nationalityName; + Null nationalityNameN; + int gender; + String genderDescription; + Null genderDescriptionN; + Null doctorTitle; + Null projectNameN; + bool isAllowWaitList; + String titleDescription; + Null titleDescriptionN; + Null isRegistered; + Null isDoctorDummy; + bool isActive; + Null isDoctorAppointmentDisplayed; + bool doctorClinicActive; + Null isbookingAllowed; + String doctorCases; + Null doctorPicture; + String doctorProfileInfo; + List specialty; + int actualDoctorRate; + String doctorImageURL; + int doctorRate; + String doctorTitleForProfile; + bool isAppointmentAllowed; + String nationalityFlagURL; + int noOfPatientsRate; + String qR; + int serviceID; + + DoctorProfile( + {this.doctorID, + this.doctorName, + this.doctorNameN, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.licenseExpiry, + this.employmentType, + this.setupID, + this.projectID, + this.projectName, + this.nationalityID, + this.nationalityName, + this.nationalityNameN, + this.gender, + this.genderDescription, + this.genderDescriptionN, + this.doctorTitle, + this.projectNameN, + this.isAllowWaitList, + this.titleDescription, + this.titleDescriptionN, + this.isRegistered, + this.isDoctorDummy, + this.isActive, + this.isDoctorAppointmentDisplayed, + this.doctorClinicActive, + this.isbookingAllowed, + this.doctorCases, + this.doctorPicture, + this.doctorProfileInfo, + this.specialty, + this.actualDoctorRate, + this.doctorImageURL, + this.doctorRate, + this.doctorTitleForProfile, + this.isAppointmentAllowed, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.qR, + this.serviceID}); + + DoctorProfile.fromJson(Map json) { + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + licenseExpiry = json['LicenseExpiry']; + employmentType = json['EmploymentType']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + nationalityID = json['NationalityID']; + nationalityName = json['NationalityName']; + nationalityNameN = json['NationalityNameN']; + gender = json['Gender']; + genderDescription = json['Gender_Description']; + genderDescriptionN = json['Gender_DescriptionN']; + doctorTitle = json['DoctorTitle']; + projectNameN = json['ProjectNameN']; + isAllowWaitList = json['IsAllowWaitList']; + titleDescription = json['Title_Description']; + titleDescriptionN = json['Title_DescriptionN']; + isRegistered = json['IsRegistered']; + isDoctorDummy = json['IsDoctorDummy']; + isActive = json['IsActive']; + isDoctorAppointmentDisplayed = json['IsDoctorAppointmentDisplayed']; + doctorClinicActive = json['DoctorClinicActive']; + isbookingAllowed = json['IsbookingAllowed']; + doctorCases = json['DoctorCases']; + doctorPicture = json['DoctorPicture']; + doctorProfileInfo = json['DoctorProfileInfo']; + specialty = json['Specialty'].cast(); + actualDoctorRate = json['ActualDoctorRate']; + doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + doctorTitleForProfile = json['DoctorTitleForProfile']; + isAppointmentAllowed = json['IsAppointmentAllowed']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + qR = json['QR']; + serviceID = json['ServiceID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['LicenseExpiry'] = this.licenseExpiry; + data['EmploymentType'] = this.employmentType; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['NationalityID'] = this.nationalityID; + data['NationalityName'] = this.nationalityName; + data['NationalityNameN'] = this.nationalityNameN; + data['Gender'] = this.gender; + data['Gender_Description'] = this.genderDescription; + data['Gender_DescriptionN'] = this.genderDescriptionN; + data['DoctorTitle'] = this.doctorTitle; + data['ProjectNameN'] = this.projectNameN; + data['IsAllowWaitList'] = this.isAllowWaitList; + data['Title_Description'] = this.titleDescription; + data['Title_DescriptionN'] = this.titleDescriptionN; + data['IsRegistered'] = this.isRegistered; + data['IsDoctorDummy'] = this.isDoctorDummy; + data['IsActive'] = this.isActive; + data['IsDoctorAppointmentDisplayed'] = this.isDoctorAppointmentDisplayed; + data['DoctorClinicActive'] = this.doctorClinicActive; + data['IsbookingAllowed'] = this.isbookingAllowed; + data['DoctorCases'] = this.doctorCases; + data['DoctorPicture'] = this.doctorPicture; + data['DoctorProfileInfo'] = this.doctorProfileInfo; + data['Specialty'] = this.specialty; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitleForProfile'] = this.doctorTitleForProfile; + data['IsAppointmentAllowed'] = this.isAppointmentAllowed; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['QR'] = this.qR; + data['ServiceID'] = this.serviceID; + return data; + } +} diff --git a/lib/core/model/doctor/doctor_rating.dart b/lib/core/model/doctor/doctor_rating.dart new file mode 100644 index 00000000..f02e052b --- /dev/null +++ b/lib/core/model/doctor/doctor_rating.dart @@ -0,0 +1,32 @@ +class DoctorRating { + Null projectID; + Null clinicID; + int doctorID; + int patientNumber; + int doctorRate; + + DoctorRating( + {this.projectID, + this.clinicID, + this.doctorID, + this.patientNumber, + this.doctorRate}); + + DoctorRating.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + patientNumber = json['PatientNumber']; + doctorRate = json['DoctorRate']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['PatientNumber'] = this.patientNumber; + data['DoctorRate'] = this.doctorRate; + return data; + } +} diff --git a/lib/core/model/doctor/patient_doctor_appointment.dart b/lib/core/model/doctor/patient_doctor_appointment.dart new file mode 100644 index 00000000..265561cd --- /dev/null +++ b/lib/core/model/doctor/patient_doctor_appointment.dart @@ -0,0 +1,325 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class PatientDoctorAppointment { + String setupID; + int projectID; + int appointmentNo; + DateTime appointmentDate; + String appointmentDateN; + bool appointmentType; + DateTime bookDate; + bool patientType; + int patientID; + int clinicID; + int doctorID; + DateTime endDate; + String startTime; + String endTime; + bool status; + bool visitType; + String visitFor; + String patientStatusType; + String actualVisitStartTime; + String actualVisitEndTime; + bool isReminderActivated; + String reminderDisplayInterval; + String reminderDisplayIntervalUnit; + String mainAppointmentNo; + String notes; + int companyID; + String dHCCPatApptRef; + String bookedBy; + DateTime bookedOn; + String confirmedBy; + DateTime confirmedOn; + String arrivalChangedBy; + DateTime arrivedOn; + String rescheduledBy; + String rescheduledOn; + String mRStatus; + String mRSentBy; + String mRSentOn; + String mRReceiptBy; + String mRReceiptOn; + String isDocumentScanned; + String documentScanDateTime; + String documentScannedUser; + String editedBy; + String editedOn; + String isRecordedByNurse; + String isCheckedByDoctor; + String isVisitClosed; + String isRecurring; + String isPersonallyConfirmed; + String confirmationBy; + String relationId; + int appointmentDays; + int isActive; + int actualDoctorRate; + String clinicName; + String doctorCases; + String doctorImageURL; + String doctorInfo; + String doctorName; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isAppointmentAllowed; + bool isDoctorAllowVedioCall; + String nationalityFlagURL; + String nationalityID; + String nationalityName; + int noOfPatientsRate; + String projectName; + String qR; + List speciality; + + PatientDoctorAppointment( + {this.setupID, + this.projectID, + this.appointmentNo, + this.appointmentDate, + this.appointmentDateN, + this.appointmentType, + this.bookDate, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.endDate, + this.startTime, + this.endTime, + this.status, + this.visitType, + this.visitFor, + this.patientStatusType, + this.actualVisitStartTime, + this.actualVisitEndTime, + this.isReminderActivated, + this.reminderDisplayInterval, + this.reminderDisplayIntervalUnit, + this.mainAppointmentNo, + this.notes, + this.companyID, + this.dHCCPatApptRef, + this.bookedBy, + this.bookedOn, + this.confirmedBy, + this.confirmedOn, + this.arrivalChangedBy, + this.arrivedOn, + this.rescheduledBy, + this.rescheduledOn, + this.mRStatus, + this.mRSentBy, + this.mRSentOn, + this.mRReceiptBy, + this.mRReceiptOn, + this.isDocumentScanned, + this.documentScanDateTime, + this.documentScannedUser, + this.editedBy, + this.editedOn, + this.isRecordedByNurse, + this.isCheckedByDoctor, + this.isVisitClosed, + this.isRecurring, + this.isPersonallyConfirmed, + this.confirmationBy, + this.relationId, + this.appointmentDays, + this.isActive, + this.actualDoctorRate, + this.clinicName, + this.doctorCases, + this.doctorImageURL, + this.doctorInfo, + this.doctorName, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isAppointmentAllowed, + this.isDoctorAllowVedioCall, + this.nationalityFlagURL, + this.nationalityID, + this.nationalityName, + this.noOfPatientsRate, + this.projectName, + this.qR, + this.speciality}); + + PatientDoctorAppointment.fromJson(Map json) { + try { + setupID = json['SetupID']; + projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = DateUtil.convertStringToDate(json['AppointmentDate']); + appointmentDateN = json['AppointmentDateN']; + appointmentType = json['AppointmentType']; + bookDate = DateUtil.convertStringToDate(json['BookDate']); + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + endDate = DateUtil.convertStringToDate(json['EndDate']); + startTime = json['StartTime']; + endTime = json['EndTime']; + status = json['Status']; + visitType = json['VisitType']; + visitFor = json['VisitFor']; + patientStatusType = json['PatientStatusType']; + actualVisitStartTime = json['ActualVisitStartTime']; + actualVisitEndTime = json['ActualVisitEndTime']; + isReminderActivated = json['IsReminderActivated']; + reminderDisplayInterval = json['ReminderDisplayInterval']; + reminderDisplayIntervalUnit = json['ReminderDisplayIntervalUnit']; + mainAppointmentNo = json['MainAppointmentNo']; + notes = json['Notes']; + companyID = json['CompanyID']; + dHCCPatApptRef = json['DHCCPatApptRef']; + bookedBy = json['BookedBy']; + // bookedOn = DateUtil.convertStringToDate(json['BookedOn']); + confirmedBy = json['ConfirmedBy']; + // confirmedOn = DateUtil.convertStringToDate(json['ConfirmedOn']); + arrivalChangedBy = json['ArrivalChangedBy']; + // arrivedOn = DateUtil.convertStringToDate(json['ArrivedOn']); + rescheduledBy = json['RescheduledBy']; + rescheduledOn = json['RescheduledOn']; + mRStatus = json['MRStatus']; + mRSentBy = json['MRSentBy']; + mRSentOn = json['MRSentOn']; + mRReceiptBy = json['MRReceiptBy']; + mRReceiptOn = json['MRReceiptOn']; + isDocumentScanned = json['IsDocumentScanned']; + documentScanDateTime = json['DocumentScanDateTime']; + documentScannedUser = json['DocumentScannedUser']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + isRecordedByNurse = json['IsRecordedByNurse']; + isCheckedByDoctor = json['IsCheckedByDoctor']; + isVisitClosed = json['IsVisitClosed']; + isRecurring = json['IsRecurring']; + isPersonallyConfirmed = json['IsPersonallyConfirmed']; + confirmationBy = json['ConfirmationBy']; + relationId = json['RelationId']; + appointmentDays = json['AppointmentDays']; + isActive = json['IsActive']; + actualDoctorRate = json['ActualDoctorRate']; + clinicName = json['ClinicName']; + doctorCases = json['DoctorCases']; + doctorImageURL = json['DoctorImageURL']; + doctorInfo = json['DoctorInfo']; + doctorName = json['DoctorName']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isAppointmentAllowed = json['IsAppointmentAllowed']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + nationalityFlagURL = json['NationalityFlagURL']; + nationalityID = json['NationalityID']; + nationalityName = json['NationalityName']; + noOfPatientsRate = json['NoOfPatientsRate']; + projectName = json['ProjectName']; + qR = json['QR']; + // speciality = json['Speciality'].cast(); + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentDateN'] = this.appointmentDateN; + data['AppointmentType'] = this.appointmentType; + data['BookDate'] = this.bookDate; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EndDate'] = this.endDate; + data['StartTime'] = this.startTime; + data['EndTime'] = this.endTime; + data['Status'] = this.status; + data['VisitType'] = this.visitType; + data['VisitFor'] = this.visitFor; + data['PatientStatusType'] = this.patientStatusType; + data['ActualVisitStartTime'] = this.actualVisitStartTime; + data['ActualVisitEndTime'] = this.actualVisitEndTime; + data['IsReminderActivated'] = this.isReminderActivated; + data['ReminderDisplayInterval'] = this.reminderDisplayInterval; + data['ReminderDisplayIntervalUnit'] = this.reminderDisplayIntervalUnit; + data['MainAppointmentNo'] = this.mainAppointmentNo; + data['Notes'] = this.notes; + data['CompanyID'] = this.companyID; + data['DHCCPatApptRef'] = this.dHCCPatApptRef; + data['BookedBy'] = this.bookedBy; + data['BookedOn'] = this.bookedOn; + data['ConfirmedBy'] = this.confirmedBy; + data['ConfirmedOn'] = this.confirmedOn; + data['ArrivalChangedBy'] = this.arrivalChangedBy; + data['ArrivedOn'] = this.arrivedOn; + data['RescheduledBy'] = this.rescheduledBy; + data['RescheduledOn'] = this.rescheduledOn; + data['MRStatus'] = this.mRStatus; + data['MRSentBy'] = this.mRSentBy; + data['MRSentOn'] = this.mRSentOn; + data['MRReceiptBy'] = this.mRReceiptBy; + data['MRReceiptOn'] = this.mRReceiptOn; + data['IsDocumentScanned'] = this.isDocumentScanned; + data['DocumentScanDateTime'] = this.documentScanDateTime; + data['DocumentScannedUser'] = this.documentScannedUser; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['IsRecordedByNurse'] = this.isRecordedByNurse; + data['IsCheckedByDoctor'] = this.isCheckedByDoctor; + data['IsVisitClosed'] = this.isVisitClosed; + data['IsRecurring'] = this.isRecurring; + data['IsPersonallyConfirmed'] = this.isPersonallyConfirmed; + data['ConfirmationBy'] = this.confirmationBy; + data['RelationId'] = this.relationId; + data['AppointmentDays'] = this.appointmentDays; + data['IsActive'] = this.isActive; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['ClinicName'] = this.clinicName; + data['DoctorCases'] = this.doctorCases; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorInfo'] = this.doctorInfo; + data['DoctorName'] = this.doctorName; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsAppointmentAllowed'] = this.isAppointmentAllowed; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NationalityID'] = this.nationalityID; + data['NationalityName'] = this.nationalityName; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['ProjectName'] = this.projectName; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + return data; + } +} + +class PatientDoctorAppointmentList{ + + String filterName =""; + List patientDoctorAppointmentList = List(); + + PatientDoctorAppointmentList({this.filterName,PatientDoctorAppointment patientDoctorAppointment}){ + patientDoctorAppointmentList.add(patientDoctorAppointment); + } + +} diff --git a/lib/core/model/doctor/reques_patient_doctor_appointmentt.dart b/lib/core/model/doctor/reques_patient_doctor_appointmentt.dart new file mode 100644 index 00000000..8ed90132 --- /dev/null +++ b/lib/core/model/doctor/reques_patient_doctor_appointmentt.dart @@ -0,0 +1,76 @@ +class RequestPatientDoctorAppointment { + int top; + double versionID; + int beforeDays; + int exludType; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + RequestPatientDoctorAppointment( + {this.top, + this.versionID, + this.beforeDays, + this.exludType, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + RequestPatientDoctorAppointment.fromJson(Map json) { + top = json['Top']; + versionID = json['VersionID']; + beforeDays = json['beforeDays']; + exludType = json['exludType']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['Top'] = this.top; + data['VersionID'] = this.versionID; + data['beforeDays'] = this.beforeDays; + data['exludType'] = this.exludType; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} diff --git a/lib/core/model/doctor/request_doctor_profile.dart b/lib/core/model/doctor/request_doctor_profile.dart new file mode 100644 index 00000000..80766b3f --- /dev/null +++ b/lib/core/model/doctor/request_doctor_profile.dart @@ -0,0 +1,72 @@ +class RequestDoctorProfile { + int doctorID; + bool license; + bool isRegistered; + int projectID; + int clinicID; + int patientID; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + RequestDoctorProfile( + {this.doctorID, + this.license, + this.isRegistered, + this.projectID, + this.clinicID, + this.patientID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + RequestDoctorProfile.fromJson(Map json) { + doctorID = json['doctorID']; + license = json['License']; + isRegistered = json['IsRegistered']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + patientID = json['PatientID']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['doctorID'] = this.doctorID; + data['License'] = this.license; + data['IsRegistered'] = this.isRegistered; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['PatientID'] = this.patientID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/doctor/request_doctor_rating.dart b/lib/core/model/doctor/request_doctor_rating.dart new file mode 100644 index 00000000..fcc9386b --- /dev/null +++ b/lib/core/model/doctor/request_doctor_rating.dart @@ -0,0 +1,52 @@ +class RequestDoctorRating { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int doctorID; + + RequestDoctorRating( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.doctorID}); + + RequestDoctorRating.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['DoctorID'] = this.doctorID; + return data; + } +} diff --git a/lib/core/model/prescriptions/Prescriptions.dart b/lib/core/model/prescriptions/Prescriptions.dart new file mode 100644 index 00000000..1362f1c2 --- /dev/null +++ b/lib/core/model/prescriptions/Prescriptions.dart @@ -0,0 +1,155 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class Prescriptions { + String setupID; + int projectID; + int patientID; + int appointmentNo; + String appointmentDate; + String doctorName; + String clinicDescription; + String name; + int episodeID; + int actualDoctorRate; + int admission; + int clinicID; + String companyName; + String despensedStatus; + DateTime dischargeDate; + int dischargeNo; + int doctorID; + String doctorImageURL; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + bool isInsurancePatient; + String nationalityFlagURL; + int noOfPatientsRate; + String qR; + List speciality; + + Prescriptions( + {this.setupID, + this.projectID, + this.patientID, + this.appointmentNo, + this.appointmentDate, + this.doctorName, + this.clinicDescription, + this.name, + this.episodeID, + this.actualDoctorRate, + this.admission, + this.clinicID, + this.companyName, + this.despensedStatus, + this.dischargeDate, + this.dischargeNo, + this.doctorID, + this.doctorImageURL, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.isInsurancePatient, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.qR, + this.speciality}); + + Prescriptions.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = json['AppointmentDate']; + doctorName = json['DoctorName']; + clinicDescription = json['ClinicDescription']; + name = json['Name']; + episodeID = json['EpisodeID']; + actualDoctorRate = json['ActualDoctorRate']; + admission = json['Admission']; + clinicID = json['ClinicID']; + companyName = json['CompanyName']; + despensedStatus = json['Despensed_Status']; + dischargeDate = DateUtil.convertStringToDate(json['DischargeDate']); + dischargeNo = json['DischargeNo']; + doctorID = json['DoctorID']; + doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + isInsurancePatient = json['IsInsurancePatient']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + qR = json['QR']; + // speciality = json['Speciality'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['DoctorName'] = this.doctorName; + data['ClinicDescription'] = this.clinicDescription; + data['Name'] = this.name; + data['EpisodeID'] = this.episodeID; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['Admission'] = this.admission; + data['ClinicID'] = this.clinicID; + data['CompanyName'] = this.companyName; + data['Despensed_Status'] = this.despensedStatus; + data['DischargeDate'] = this.dischargeDate; + data['DischargeNo'] = this.dischargeNo; + data['DoctorID'] = this.doctorID; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['IsInsurancePatient'] = this.isInsurancePatient; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + return data; + } +} + +class PrescriptionsList { + String filterName = ""; + List prescriptionsList = List(); + + PrescriptionsList({this.filterName, Prescriptions prescriptions}) { + prescriptionsList.add(prescriptions); + } +} diff --git a/lib/core/model/prescriptions/prescription_report.dart b/lib/core/model/prescriptions/prescription_report.dart new file mode 100644 index 00000000..51f5750f --- /dev/null +++ b/lib/core/model/prescriptions/prescription_report.dart @@ -0,0 +1,127 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class PrescriptionReport { + int patientID; + String patientName; + String patientAge; + String patientGender; + String address; + String phoneOffice; + String itemDescription; + int doseTimingID; + int frequencyID; + int routeID; + String clinic; + String doctorName; + String route; + String frequency; + String remarks; + String name; + int days; + String startDate; + String orderDate; + int doseDailyQuantity; + int itemID; + Null productImage; + String sKU; + String itemDescriptionN; + String routeN; + String frequencyN; + String imageSRCUrl; + String imageThumbUrl; + + PrescriptionReport( + {this.patientID, + this.patientName, + this.patientAge, + this.patientGender, + this.address, + this.phoneOffice, + this.itemDescription, + this.doseTimingID, + this.frequencyID, + this.routeID, + this.clinic, + this.doctorName, + this.route, + this.frequency, + this.remarks, + this.name, + this.days, + this.startDate, + this.orderDate, + this.doseDailyQuantity, + this.itemID, + this.productImage, + this.sKU, + this.itemDescriptionN, + this.routeN, + this.frequencyN, + this.imageSRCUrl, + this.imageThumbUrl}); + + PrescriptionReport.fromJson(Map json) { + patientID = json['PatientID']; + patientName = json['PatientName']; + patientAge = json['PatientAge']; + patientGender = json['PatientGender']; + address = json['Address']; + phoneOffice = json['PhoneOffice']; + itemDescription = json['ItemDescription']; + doseTimingID = json['DoseTimingID']; + frequencyID = json['FrequencyID']; + routeID = json['RouteID']; + clinic = json['Clinic']; + doctorName = json['DoctorName']; + route = json['Route']; + frequency = json['Frequency']; + remarks = json['Remarks']; + name = json['Name']; + days = json['Days']; + startDate = json['StartDate']; + orderDate = json['OrderDate']; + doseDailyQuantity = json['DoseDailyQuantity']; + itemID = json['ItemID']; + productImage = json['ProductImage']; + sKU = json['SKU']; + itemDescriptionN = json['ItemDescriptionN']; + routeN = json['RouteN']; + frequencyN = json['FrequencyN']; + imageSRCUrl = json['ImageSRCUrl']; + imageThumbUrl = json['ImageThumbUrl']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PatientAge'] = this.patientAge; + data['PatientGender'] = this.patientGender; + data['Address'] = this.address; + data['PhoneOffice'] = this.phoneOffice; + data['ItemDescription'] = this.itemDescription; + data['DoseTimingID'] = this.doseTimingID; + data['FrequencyID'] = this.frequencyID; + data['RouteID'] = this.routeID; + data['Clinic'] = this.clinic; + data['DoctorName'] = this.doctorName; + data['Route'] = this.route; + data['Frequency'] = this.frequency; + data['Remarks'] = this.remarks; + data['Name'] = this.name; + data['Days'] = this.days; + data['StartDate'] = this.startDate; + data['OrderDate'] = this.orderDate; + data['DoseDailyQuantity'] = this.doseDailyQuantity; + data['ItemID'] = this.itemID; + data['ProductImage'] = this.productImage; + data['SKU'] = this.sKU; + data['ItemDescriptionN'] = this.itemDescriptionN; + data['RouteN'] = this.routeN; + data['FrequencyN'] = this.frequencyN; + data['ImageSRCUrl'] = this.imageSRCUrl; + data['ImageThumbUrl'] = this.imageThumbUrl; + data['hasPlan'] = false; + return data; + } +} diff --git a/lib/core/model/prescriptions/prescriptions_order.dart b/lib/core/model/prescriptions/prescriptions_order.dart new file mode 100644 index 00000000..db2b1855 --- /dev/null +++ b/lib/core/model/prescriptions/prescriptions_order.dart @@ -0,0 +1,134 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class PrescriptionsOrder { + int iD; + String patientID; + bool patientOutSA; + bool isOutPatient; + int projectID; + int nearestProjectID; + double longitude; + double latitude; + String appointmentNo; + String dischargeID; + int lineItemNo; + int status; + String description; + String descriptionN; + DateTime createdOn; + int serviceID; + int createdBy; + DateTime editedOn; + int editedBy; + int channel; + String clientRequestID; + bool returnedToQueue; + Null pickupDateTime; + Null pickupLocationName; + Null dropoffLocationName; + int realRRTHaveTransactions; + String nearestProjectDescription; + String nearestProjectDescriptionN; + String projectDescription; + String projectDescriptionN; + + PrescriptionsOrder( + {this.iD, + this.patientID, + this.patientOutSA, + this.isOutPatient, + this.projectID, + this.nearestProjectID, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeID, + this.lineItemNo, + this.status, + this.description, + this.descriptionN, + this.createdOn, + this.serviceID, + this.createdBy, + this.editedOn, + this.editedBy, + this.channel, + this.clientRequestID, + this.returnedToQueue, + this.pickupDateTime, + this.pickupLocationName, + this.dropoffLocationName, + this.realRRTHaveTransactions, + this.nearestProjectDescription, + this.nearestProjectDescriptionN, + this.projectDescription, + this.projectDescriptionN}); + + PrescriptionsOrder.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + isOutPatient = json['IsOutPatient']; + projectID = json['ProjectID']; + nearestProjectID = json['NearestProjectID']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeID = json['DischargeID']; + lineItemNo = json['LineItemNo']; + status = json['Status']; + description = json['Description']; + descriptionN = json['DescriptionN']; + createdOn = DateUtil.convertStringToDate(json['CreatedOn']); + serviceID = json['ServiceID']; + createdBy = json['CreatedBy']; + editedOn = DateUtil.convertStringToDate(json['EditedOn']); + editedBy = json['EditedBy']; + channel = json['Channel']; + clientRequestID = json['ClientRequestID']; + returnedToQueue = json['ReturnedToQueue']; + pickupDateTime = json['PickupDateTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + realRRTHaveTransactions = json['RealRRT_HaveTransactions']; + nearestProjectDescription = json['NearestProjectDescription']; + nearestProjectDescriptionN = json['NearestProjectDescriptionN']; + projectDescription = json['ProjectDescription']; + projectDescriptionN = json['ProjectDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectID'] = this.projectID; + data['NearestProjectID'] = this.nearestProjectID; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeID'] = this.dischargeID; + data['LineItemNo'] = this.lineItemNo; + data['Status'] = this.status; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['CreatedOn'] = this.createdOn; + data['ServiceID'] = this.serviceID; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['Channel'] = this.channel; + data['ClientRequestID'] = this.clientRequestID; + data['ReturnedToQueue'] = this.returnedToQueue; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['RealRRT_HaveTransactions'] = this.realRRTHaveTransactions; + data['NearestProjectDescription'] = this.nearestProjectDescription; + data['NearestProjectDescriptionN'] = this.nearestProjectDescriptionN; + data['ProjectDescription'] = this.projectDescription; + data['ProjectDescriptionN'] = this.projectDescriptionN; + return data; + } +} diff --git a/lib/core/model/prescriptions/request_prescription_report.dart b/lib/core/model/prescriptions/request_prescription_report.dart new file mode 100644 index 00000000..c8323740 --- /dev/null +++ b/lib/core/model/prescriptions/request_prescription_report.dart @@ -0,0 +1,88 @@ +class RequestPrescriptionReport { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + int appointmentNo; + String setupID; + int episodeID; + int clinicID; + int projectID; + int dischargeNo; + + RequestPrescriptionReport( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.appointmentNo, + this.setupID, + this.episodeID, + this.clinicID, + this.projectID, + this.dischargeNo}); + + RequestPrescriptionReport.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + appointmentNo = json['AppointmentNo']; + setupID = json['SetupID']; + episodeID = json['EpisodeID']; + clinicID = json['ClinicID']; + projectID = json['ProjectID']; + dischargeNo = json['DischargeNo']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['AppointmentNo'] = this.appointmentNo; + data['SetupID'] = this.setupID; + data['EpisodeID'] = this.episodeID; + data['ClinicID'] = this.clinicID; + data['ProjectID'] = this.projectID; + data['DischargeNo'] = this.dischargeNo; + return data; + } +} diff --git a/lib/core/model/prescriptions/request_prescriptions.dart b/lib/core/model/prescriptions/request_prescriptions.dart new file mode 100644 index 00000000..abb39143 --- /dev/null +++ b/lib/core/model/prescriptions/request_prescriptions.dart @@ -0,0 +1,64 @@ +class RequestPrescriptions { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + RequestPrescriptions( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + RequestPrescriptions.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} diff --git a/lib/core/model/prescriptions/request_prescriptions_orders.dart b/lib/core/model/prescriptions/request_prescriptions_orders.dart new file mode 100644 index 00000000..9aaab33d --- /dev/null +++ b/lib/core/model/prescriptions/request_prescriptions_orders.dart @@ -0,0 +1,52 @@ +class RequestPrescriptionsOrders { + int patientID; + int patientOutSA; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + RequestPrescriptionsOrders( + {this.patientID, + this.patientOutSA, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + RequestPrescriptionsOrders.fromJson(Map json) { + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/prescriptions/request_send_prescription_email.dart b/lib/core/model/prescriptions/request_send_prescription_email.dart new file mode 100644 index 00000000..2d1f3aa3 --- /dev/null +++ b/lib/core/model/prescriptions/request_send_prescription_email.dart @@ -0,0 +1,112 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; + +class RequestSendPrescriptionEmail { + String appointmentDate; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + String to; + String dateofBirth; + String patientIditificationNum; + String patientMobileNumber; + String patientName; + String setupID; + String clinicName; + String doctorName; + int projectID; + List listPrescriptions; + + RequestSendPrescriptionEmail( + {this.appointmentDate, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.to, + this.dateofBirth, + this.patientIditificationNum, + this.patientMobileNumber, + this.patientName, + this.setupID, + this.clinicName, + this.doctorName, + this.projectID}); + + RequestSendPrescriptionEmail.fromJson(Map json) { + appointmentDate = json['AppointmentDate']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + to = json['To']; + dateofBirth = json['DateofBirth']; + patientIditificationNum = json['PatientIditificationNum']; + patientMobileNumber = json['PatientMobileNumber']; + patientName = json['PatientName']; + setupID = json['SetupID']; + clinicName = json['ClinicName']; + doctorName = json['DoctorName']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentDate'] = this.appointmentDate; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['To'] = this.to; + data['DateofBirth'] = this.dateofBirth; + data['PatientIditificationNum'] = this.patientIditificationNum; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientName'] = this.patientName; + data['SetupID'] = this.setupID; + if (this.listPrescriptions != null) { + data['ListPrescriptions'] = + this.listPrescriptions.map((v) => v.toJson()).toList(); + } + data['ClinicName'] = this.clinicName; + data['DoctorName'] = this.doctorName; + data['ProjectID'] = this.projectID; + + return data; + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 57686824..57910888 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -43,6 +43,7 @@ class BaseAppClient { if (!parsed['IsAuthenticated']) { // await helpers.logout(); //helpers.showErrorToast('Your session expired Please login agian'); + var asd =""; // TODO create logout fun } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); diff --git a/lib/core/service/medical/my_doctor_service.dart b/lib/core/service/medical/my_doctor_service.dart new file mode 100644 index 00000000..349d7ace --- /dev/null +++ b/lib/core/service/medical/my_doctor_service.dart @@ -0,0 +1,102 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/reques_patient_doctor_appointmentt.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/request_doctor_profile.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/request_doctor_rating.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class MyDoctorService extends BaseService { + List patientDoctorAppointmentList = List(); + DoctorProfile doctorProfile; + DoctorRating doctorRating = DoctorRating(); + + RequestPatientDoctorAppointment patientDoctorAppointmentRequest = + RequestPatientDoctorAppointment( + top: 0, + versionID: 5.5, + beforeDays: 0, + exludType: 4, + channel: 3, + languageID: 2, + iPAdress: '10.20.10.20', + generalid: 'Cs2020@2016\$2958', + patientOutSA: 0, + sessionID: 'TMRhVmkGhOsvamErw', + isDentalAllowedBackend: false, + deviceTypeID: 1, + patientID: 1231755, + tokenID: '@dm!n', + patientType: 1, + patientTypeID: 1); + + RequestDoctorRating _requestDoctorRating = RequestDoctorRating( + channel: 3, + deviceTypeID: 2, + doctorID: 2477, + iPAdress: '10.20.10.20', + languageID: 2, + patientOutSA: 0, + sessionID: 'CvsUFeJkyLDnFQqw', + versionID: 5.5, + generalid: 'Cs2020@2016\$2958', + isDentalAllowedBackend: false); + + Future getPatientDoctorAppointmentList() async { + await baseAppClient.post(GET_MY_DOCTOR, + onSuccess: (dynamic response, int statusCode) { + patientDoctorAppointmentList.clear(); + response['PatientDoctorAppointmentResultList'].forEach((hospital) { + patientDoctorAppointmentList + .add(PatientDoctorAppointment.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patientDoctorAppointmentRequest.toJson()); + } + + RequestDoctorProfile _requestDoctorProfile = RequestDoctorProfile( + doctorID: 2477, + license: true, + isRegistered: true, + projectID: 12, + clinicID: 501, + patientID: 1231755, + versionID: 5.5, + channel: 3, + languageID: 2, + iPAdress: '10.20.10.20', + generalid: 'Cs2020@2016\$2958', + patientOutSA: 0, + sessionID: 'nstatCtNEmuwxeuVAOUmw', + isDentalAllowedBackend: false, + deviceTypeID: 2, + ); + + Future getDoctorProfileAndRating({int doctorId,int clinicID,int projectID }) async { + ///GET DOCTOR PROFILE + _requestDoctorProfile.doctorID = doctorId; + _requestDoctorProfile.clinicID = clinicID; + _requestDoctorProfile.patientID = projectID; + hasError = false; + await baseAppClient.post(GET_DOCTOR_PROFILE, + onSuccess: (dynamic response, int statusCode) { + doctorProfile = DoctorProfile.fromJson(response['DoctorProfileList'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestDoctorProfile.toJson()); + + ///GET DOCTOR RATING + //_requestDoctorRating.doctorID = doctorId; + await baseAppClient.post(GET_DOCTOR_RATING, + onSuccess: (dynamic response, int statusCode) { + doctorRating = DoctorRating.fromJson(response['AvgDoctorRatingList'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestDoctorRating.toJson()); + } +} diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart new file mode 100644 index 00000000..3e7259f7 --- /dev/null +++ b/lib/core/service/medical/prescriptions_service.dart @@ -0,0 +1,149 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescription_report.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions_orders.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/request_send_prescription_email.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PrescriptionsService extends BaseService { + List prescriptionsList = List(); + RequestPrescriptions _requestPrescriptions = RequestPrescriptions( + versionID: 5.5, + channel: 3, + languageID: 2, + iPAdress: '10.20.10.20', + generalid: 'Cs2020@2016\$2958', + patientOutSA: 0, + sessionID: 'KIbLoqkytuKJEWECHQ', + isDentalAllowedBackend: false, + deviceTypeID: 2, + patientID: 1231755, + tokenID: '@dm!n', + patientTypeID: 1, + patientType: 1); + + List prescriptionsOrderList = List(); + RequestPrescriptionsOrders _requestPrescriptionsOrders = + RequestPrescriptionsOrders( + patientID: 1231755, + patientOutSA: 0, + versionID: 5.5, + channel: 3, + languageID: 1, + iPAdress: '10.20.10.20', + generalid: 'Cs2020@2016\$2958', + sessionID: 'KIbLoqkytuKJEWECHQ', + isDentalAllowedBackend: false, + deviceTypeID: 2); + + Future getPrescriptions() async { + hasError = false; + await baseAppClient.post(PRESCRIPTIONS, + onSuccess: (dynamic response, int statusCode) { + prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((prescriptions) { + prescriptionsList.add(Prescriptions.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptions.toJson()); + } + + Future getPrescriptionsOrders() async { + await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, + onSuccess: (dynamic response, int statusCode) { + prescriptionsOrderList.clear(); + response['PatientER_GetPatientAllPresOrdersList'] + .forEach((prescriptionsOrder) { + prescriptionsOrderList + .add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptionsOrders.toJson()); + } + + RequestPrescriptionReport _requestPrescriptionReport = + RequestPrescriptionReport( + appointmentNo: 0, + channel: 3, + clinicID: 4, + deviceTypeID: 2, + dischargeNo: 2018003246, + episodeID: 0, + iPAdress: '10.20.10.20', + languageID: 1, + patientID: 1231755, + patientOutSA: 0, + patientType: 1, + patientTypeID: 1, + projectID: 12, + sessionID: 'wgKuHpsPsEuLnlJhAYCQ', + tokenID: '@dm!n', + setupID: "91877", + versionID: 5.5, + generalid: 'Cs2020@2016\$2958', + isDentalAllowedBackend: false); + List prescriptionReportList = List(); + + Future getPrescriptionReport({int dischargeNo}) async { + hasError = false; + _requestPrescriptionReport.dischargeNo = dischargeNo; + await baseAppClient.post(GET_PRESCRIPTION_REPORT, + onSuccess: (dynamic response, int statusCode) { + prescriptionReportList.clear(); + response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { + prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptionReport.toJson()); + } + + RequestSendPrescriptionEmail _requestSendPrescriptionEmail = + RequestSendPrescriptionEmail( + versionID: 5.5, + languageID: 2, + channel: 3, + iPAdress: '10.20.10.20', + generalid: 'Cs2020@2016\$2958', + patientOutSA: 0, + sessionID: 'twIUmHfOHqFdDfVcyw', + isDentalAllowedBackend: false, + deviceTypeID: 2, + tokenID: '@dm!n', + patientTypeID: 1, + patientType: 1, + to: 'aljammalzmohammad@outlook.com', + dateofBirth: '/Date(536743800000+0300)/', + patientIditificationNum: '2344670985', + patientMobileNumber: '537503378', + patientName: 'TAMER FANASHEH', + setupID: '91877'); + + Future sendPrescriptionEmail(String appointmentDate, int patientID, + String clinicName, String doctorName, int projectID) async { + _requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList; + _requestSendPrescriptionEmail.appointmentDate = appointmentDate; + _requestSendPrescriptionEmail.patientID = patientID; + _requestSendPrescriptionEmail.clinicName = clinicName; + _requestSendPrescriptionEmail.doctorName = doctorName; + _requestSendPrescriptionEmail.projectID = projectID; + hasError = false; + await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, + onSuccess: (dynamic response, int statusCode){ + var asd = ""; + + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestSendPrescriptionEmail.toJson()); + } +} diff --git a/lib/core/viewModels/medical/my_doctor_view_model.dart b/lib/core/viewModels/medical/my_doctor_view_model.dart new file mode 100644 index 00000000..e04f9bdd --- /dev/null +++ b/lib/core/viewModels/medical/my_doctor_view_model.dart @@ -0,0 +1,97 @@ +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; +import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class MyDoctorViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; + MyDoctorService _myDoctorService = locator(); + + List _patientDoctorAppointmentListClinic = + List(); + List _patientDoctorAppointmentListHospital = + List(); + + List get patientDoctorAppointmentList => + filterType == FilterType.Clinic + ? _patientDoctorAppointmentListClinic + : _patientDoctorAppointmentListHospital; + + DoctorProfile get doctorProfile => _myDoctorService.doctorProfile; + DoctorRating get doctorRating => _myDoctorService.doctorRating; + + void getMyDoctor() async { + setState(ViewState.Busy); + await _myDoctorService.getPatientDoctorAppointmentList(); + if (_myDoctorService.hasError) { + error = _myDoctorService.error; + setState(ViewState.Error); + } else { + _myDoctorService.patientDoctorAppointmentList.forEach((element) { + List doctorByClinic = + _patientDoctorAppointmentListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicName) + .toList(); + + if (doctorByClinic.length != 0) { + _patientDoctorAppointmentListClinic[ + _patientDoctorAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListClinic.add(PatientDoctorAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + + // doctor list sort via project + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); + + setState(ViewState.Idle); + } + } + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } + + void getDoctorProfileAndRating({int doctorId,int clinicID,int projectID }) async { + setState(ViewState.Busy); + await _myDoctorService.getDoctorProfileAndRating(doctorId: doctorId,clinicID: clinicID,projectID: projectID); + if (_myDoctorService.hasError) { + error = _myDoctorService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + +} diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart new file mode 100644 index 00000000..75ff319f --- /dev/null +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -0,0 +1,126 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + +import '../../../core/enum/filter_type.dart'; +import '../../../core/enum/viewstate.dart'; +import '../../../core/model/prescriptions/Prescriptions.dart'; +import '../../../core/service/medical/prescriptions_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class PrescriptionsViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; + PrescriptionsService _prescriptionsService = locator(); + + List _prescriptionsOrderListClinic = List(); + List _prescriptionsOrderListHospital = List(); + + List get prescriptionReportList => + _prescriptionsService.prescriptionReportList; + + List get prescriptionsList => + _prescriptionsService.prescriptionsList; + + List get prescriptionsOrderList => + filterType == FilterType.Clinic + ? _prescriptionsOrderListClinic + : _prescriptionsOrderListHospital; + + getPrescriptions() async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptions(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + _filterList(); + await _getPrescriptionsOrders(); + setState(ViewState.Idle); + } + } + + void _filterList() { + _prescriptionsService.prescriptionsList.forEach((element) { + /// PrescriptionsList list sort clinic + List prescriptionsByClinic = + _prescriptionsOrderListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (prescriptionsByClinic.length != 0) { + _prescriptionsOrderListClinic[ + _prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])] + .prescriptionsList + .add(element); + } else { + _prescriptionsOrderListClinic.add(PrescriptionsList( + filterName: element.clinicDescription, prescriptions: element)); + } + + /// PrescriptionsList list sort via hospital + List prescriptionsByHospital = + _prescriptionsOrderListHospital + .where( + (elementClinic) => elementClinic.filterName == element.name, + ) + .toList(); + + if (prescriptionsByHospital.length != 0) { + _prescriptionsOrderListHospital[_prescriptionsOrderListHospital + .indexOf(prescriptionsByHospital[0])] + .prescriptionsList + .add(element); + } else { + _prescriptionsOrderListHospital.add(PrescriptionsList( + filterName: element.name, prescriptions: element)); + } + }); + } + + _getPrescriptionsOrders() async { + await _prescriptionsService.getPrescriptionsOrders(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } + + getPrescriptionReport({int dischargeNo}) async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptionReport(dischargeNo: dischargeNo); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + sendPrescriptionEmail( + {String appointmentDate, + int patientID, + String clinicName, + String doctorName, + int projectID}) async { + setState(ViewState.BusyLocal); + await _prescriptionsService.sendPrescriptionEmail( + appointmentDate, patientID, clinicName, doctorName, projectID); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + AppToast.showSuccessToast(message: error); + } else { + AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); + setState(ViewState.Idle); + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index f6a76c1c..c1a2a170 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,7 +1,11 @@ import 'package:get_it/get_it.dart'; import 'core/service/hospital_service.dart'; +import 'core/service/medical/my_doctor_service.dart'; +import 'core/service/medical/prescriptions_service.dart'; import 'core/viewModels/hospital_view_model.dart'; +import 'core/viewModels/medical/my_doctor_view_model.dart'; +import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; @@ -12,8 +16,12 @@ void setupLocator() { /// Services locator.registerLazySingleton(() => HospitalService()); locator.registerLazySingleton(() => PharmacyService()); + locator.registerLazySingleton(() => MyDoctorService()); + locator.registerLazySingleton(() => PrescriptionsService()); /// View Model locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => PharmacyViewModel()); + locator.registerFactory(() => MyDoctorViewModel()); + locator.registerFactory(() => PrescriptionsViewModel()); } diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index ffb5f6be..07d13e9a 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -72,7 +72,7 @@ class _AppointmentDetailsState extends State with SingleTick margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, child: RatingBar.readOnly( - initialRating: 4.0, + initialRating: 3.5, size: 35.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 50c32c78..18dd45af 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -2,9 +2,10 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/auth/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/replay_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/providers/auth_provider.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_admissions_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; @@ -71,7 +72,7 @@ class _LandingPageState extends State { body: PageView( physics: NeverScrollableScrollPhysics(), controller: pageController, - children: [HomePage(), MedicineSearch(), MedicalPage(), MyAdmissionsPage()], + children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()], ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), ); diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart new file mode 100644 index 00000000..c9bce380 --- /dev/null +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -0,0 +1,110 @@ +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +import 'doctor_profile_page.dart'; + +class DoctorHomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getMyDoctor(), + builder: (context, MyDoctorViewModel model, widget) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: 'My Doctors', + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: FractionallySizedBox( + widthFactor: 1.0, + child: Center( + child: Column( + children: [ + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () => model.setFilterType(FilterType.Clinic), + child: ListTile( + title: const Text('Clinic'), + leading: Radio( + value: FilterType.Clinic, + groupValue: model.filterType, + activeColor: Colors.red[800], + onChanged: (FilterType value) { + model.setFilterType(value); + }, + ), + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => model.setFilterType(FilterType.Hospital), + child: ListTile( + title: const Text('Hospital'), + leading: Radio( + value: FilterType.Hospital, + groupValue: model.filterType, + activeColor: Colors.red[800], + onChanged: (FilterType value) => + model.setFilterType(value), + ), + ), + ), + ) + ], + ), + ...List.generate( + model.patientDoctorAppointmentList.length, + (index) => AppExpandableNotifier( + title: model + .patientDoctorAppointmentList[index].filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: model.patientDoctorAppointmentList[index] + .patientDoctorAppointmentList + .map((doctor) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: DoctorProfilePage( + patientDoctorAppointment: doctor, + ), + ), + ); + }, + child: DoctorCard( + name: doctor.doctorName, + profileUrl: doctor.doctorImageURL, + rat: doctor.doctorRate.toDouble(), + subName: DateUtil.getMonthDayYearDateFormatted( + doctor.appointmentDate), + ), + ); + }).toList(), + )), + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/doctor/doctor_information_page.dart b/lib/pages/medical/doctor/doctor_information_page.dart new file mode 100644 index 00000000..7634cde2 --- /dev/null +++ b/lib/pages/medical/doctor/doctor_information_page.dart @@ -0,0 +1,199 @@ +import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DoctorInformation extends StatefulWidget { + final DoctorProfile doctorProfile; + + const DoctorInformation({Key key, this.doctorProfile}) : super(key: key); + + @override + _DoctorInformationState createState() => _DoctorInformationState(); +} + +class _DoctorInformationState extends State { + bool _isShowInfo = true; + bool _isScientificQualification = true; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.grey[200], + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10, right: 10, left: 10), + padding: EdgeInsets.all(10.0), + width: double.infinity, + //height: 250, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.person, + size: 25, + color: Colors.red[700], + ), + SizedBox( + width: 10, + ), + Expanded(child: Texts(widget.doctorProfile.doctorName)), + InkWell( + onTap: () { + setState(() { + _isShowInfo = !_isShowInfo; + }); + }, + child: Container( + margin: EdgeInsets.all(5), + decoration: + BoxDecoration(shape: BoxShape.circle, boxShadow: [ + BoxShadow( + color: Colors.red[700], + blurRadius: 1.0, + spreadRadius: 0.0, + ) + ]), + child: Icon( + _isShowInfo + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down , + size: 25, + color: Colors.white, + )), + ), + ], + ), + if (_isShowInfo) + AnimatedContainer( + duration: Duration(milliseconds: 7000), + margin: EdgeInsets.only(top: 20), + // height: 150, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Gender'), + Texts( + widget.doctorProfile.genderDescription, + variant: 'overline', + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Nationality'), + Texts( + widget.doctorProfile.nationalityName, + variant: 'overline', + ), + ], + ), + ], + ), + SizedBox( + height: 5, + ), + Divider( + height: 3, + color: Colors.grey, + ), + SizedBox( + height: 5, + ), + Texts('Clinic'), + Texts( + widget.doctorProfile.clinicDescription, + variant: 'overline', + ), + ], + ), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10, right: 10, left: 10), + padding: EdgeInsets.all(10.0), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.local_play, + size: 25, + color: Colors.red[700], + ), + SizedBox( + width: 10, + ), + Expanded(child: Texts(widget.doctorProfile.doctorName)), + InkWell( + onTap: () { + setState(() { + _isScientificQualification = + !_isScientificQualification; + }); + }, + child: Container( + margin: EdgeInsets.all(5), + decoration: + BoxDecoration(shape: BoxShape.circle, boxShadow: [ + BoxShadow( + color: Colors.red[700], + blurRadius: 1.0, + spreadRadius: 0.0, + ) + ]), + child: Icon( + _isScientificQualification + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 25, + color: Colors.white, + )), + ), + ], + ), + if (_isScientificQualification) + AnimatedContainer( + duration: Duration(milliseconds: 7000), + margin: EdgeInsets.only(top: 20), + // height: 150, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(widget.doctorProfile.doctorProfileInfo,) + ], + ), + ) + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/medical/doctor/doctor_profile_page.dart b/lib/pages/medical/doctor/doctor_profile_page.dart new file mode 100644 index 00000000..61bfd804 --- /dev/null +++ b/lib/pages/medical/doctor/doctor_profile_page.dart @@ -0,0 +1,181 @@ +import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:rating_bar/rating_bar.dart'; + +import 'doctor_information_page.dart'; + +class DoctorProfilePage extends StatefulWidget { + final PatientDoctorAppointment patientDoctorAppointment; + + DoctorProfilePage({this.patientDoctorAppointment}); + + @override + _DoctorProfilePageState createState() => + _DoctorProfilePageState(patientDoctorAppointment); +} + +class _DoctorProfilePageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + final PatientDoctorAppointment patientDoctorAppointment; + + _DoctorProfilePageState(this.patientDoctorAppointment); + + @override + void initState() { + _tabController = new TabController(length: 2, vsync: this); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getDoctorProfileAndRating( + doctorId: widget.patientDoctorAppointment.doctorID, + clinicID: widget.patientDoctorAppointment.clinicID, + projectID: widget.patientDoctorAppointment.projectID), + builder: (context, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Doctor Profile', + baseViewModel: model, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(5), + width: 50, + height: 50, + decoration: + BoxDecoration(shape: BoxShape.circle, + color: Colors.grey + ), + child: Icon( + Icons.calendar_view_day, + size: 25, + color: Colors.white, + )), + ClipRRect( + borderRadius: BorderRadius.circular(100.0), + child: Image.network( + patientDoctorAppointment.doctorImageURL, + fit: BoxFit.fill, + height: 120.0, + width: 120.0), + ), + Container( + margin: EdgeInsets.all(5), + width: 50, + height: 50, + decoration: + BoxDecoration(shape: BoxShape.circle, + color: Colors.grey + ), + child: Icon( + Icons.format_list_bulleted, + size: 25, + color: Colors.white, + )), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.center, + child: Text(patientDoctorAppointment.doctorName, + style: TextStyle( + fontSize: 20.0, + color: Colors.grey[900], + letterSpacing: 1.0)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.center, + child: Text(patientDoctorAppointment.clinicName, + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[900], + letterSpacing: 1.0)), + ), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: + model.doctorRating.doctorRate.toDouble() ?? + 0.0, + size: 35.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: Text( + "(${model.doctorRating.patientNumber ?? 0} Reviews)", + style: TextStyle( + fontSize: 14.0, + color: Colors.blue[800], + letterSpacing: 1.0, + decoration: TextDecoration.underline, + )), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Divider( + color: Colors.grey[500], + ), + ), + TabBar( + indicatorColor: Colors.red[800], + indicatorWeight: 3.0, + tabs: [ + Tab( + child: Text( + 'Doctor Information', + style: TextStyle(color: Colors.black))), + Tab( + child: Text( + TranslationBase.of(context).availableAppo, + style: TextStyle(color: Colors.black)), + ) + ], + controller: _tabController, + ), + Container( + height: MediaQuery.of(context).size.height * 0.8, + child: TabBarView( + physics: BouncingScrollPhysics(), + children: [DoctorInformation(doctorProfile: model.doctorProfile,), Container()], + controller: _tabController, + ), + ), + ], + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/medical/medical_page.dart b/lib/pages/medical/medical_profile_page.dart similarity index 68% rename from lib/pages/medical/medical_page.dart rename to lib/pages/medical/medical_profile_page.dart index 049ba0bc..ceacaed4 100644 --- a/lib/pages/medical/medical_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,18 +1,21 @@ import 'dart:math'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class MedicalPage extends StatefulWidget { - @override - _MedicalPageState createState() => _MedicalPageState(); +import 'doctor/doctor_home_page.dart'; +class MedicalProfilePage extends StatefulWidget { + @override + _MedicalProfilePageState createState() => _MedicalProfilePageState(); } -class _MedicalPageState extends State { +class _MedicalProfilePageState extends State { @override Widget build(BuildContext context) { return AppScaffold( @@ -39,23 +42,32 @@ class _MedicalPageState extends State { padding: EdgeInsets.symmetric(vertical: 12.0), child: Column( children: [ - Row( children: [ Expanded( flex: 1, - child: MedicalProfileItem( - title: 'My Doctor', - imagePath: 'doctor_icon.png', - subTitle: 'List', + child: InkWell( + onTap: (){ + Navigator.push(context, FadePage(page: DoctorHomePage())); + }, + child: MedicalProfileItem( + title: 'My Doctor', + imagePath: 'doctor_icon.png', + subTitle: 'List', + ), ), ), Expanded( flex: 1, - child: MedicalProfileItem( - title: 'Lab', - imagePath: 'lab_result_icon.png', - subTitle: 'Result', + child: InkWell( + onTap: (){ + + }, + child: MedicalProfileItem( + title: 'Lab', + imagePath: 'lab_result_icon.png', + subTitle: 'Result', + ), ), ) ], @@ -72,10 +84,16 @@ class _MedicalPageState extends State { ), Expanded( flex: 1, - child: MedicalProfileItem( - title: 'Medicines', - imagePath: 'prescription_icon.png', - subTitle: 'Prescriptions', + child: InkWell( + onTap: (){ + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); + + }, + child: MedicalProfileItem( + title: 'Medicines', + imagePath: 'prescription_icon.png', + subTitle: 'Prescriptions', + ), ), ) ], @@ -114,7 +132,6 @@ class _MedicalPageState extends State { flex: 1, child: Container(), ) - ], ), ], @@ -123,10 +140,7 @@ class _MedicalPageState extends State { ), ), ], - ), ); } } - - diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart new file mode 100644 index 00000000..35a9a307 --- /dev/null +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -0,0 +1,175 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionDetailsPage extends StatelessWidget { + final PrescriptionReport prescriptionReport; + + PrescriptionDetailsPage({Key key, this.prescriptionReport}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Prescription Details', + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(prescriptionReport.itemDescription)), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8), + child: InkWell( + onTap: () {}, + child: Center( + child: Column( + children: [ + Container( + width: 50, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle + ), + child: Column( + children: [ + Icon( + Icons.pin_drop, + color: Colors.red[800], + size: 55, + ), + ], + ), + ), + SizedBox(height: 5,), + Texts('Ports') + + ], + ), + )), + ), + Container( + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + child: Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + outside: BorderSide(width: 0.5)), + children: [ + TableRow( + children: [ + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center(child: Texts('Way'))), + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center(child: Texts('Average'))), + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center(child: Texts('Daily doses'))), + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center(child: Texts('Period'))), + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: + Center(child: Text(prescriptionReport.routeN))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: Center( + child: Text(prescriptionReport.frequencyN))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: Center( + child: Text( + '${prescriptionReport.doseDailyQuantity}'))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: + Center(child: Text('${prescriptionReport.days}'))) + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(5), + child: Center( + child: Column( + children: [ + Texts('Notes'), + SizedBox( + height: 5, + ), + Divider( + height: 0.5, + color: Colors.grey[300], + ), + SizedBox( + height: 5, + ), + Texts(' '), + ], + ), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart new file mode 100644 index 00000000..c84be7bd --- /dev/null +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -0,0 +1,112 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionItemsPage extends StatelessWidget { + final Prescriptions prescriptions; + + PrescriptionItemsPage({Key key, this.prescriptions}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => + model.getPrescriptionReport(dischargeNo: prescriptions.dischargeNo), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Items', + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 0.8, + child: ListView.builder( + itemBuilder: (context, index) => InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: model.prescriptionReportList[index], + ), + ), + ), + child: Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.prescriptionReportList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(model + .prescriptionReportList[index].itemDescription)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + ), + ), + itemCount: model.prescriptionReportList.length, + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.2, + color: Colors.grey[100], + child: Column( + children: [ + Divider(), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Send Copy', + onTap: () => model.sendPrescriptionEmail( + appointmentDate: prescriptions.appointmentDate, + patientID: prescriptions.patientID, + clinicName: prescriptions.companyName, + doctorName: prescriptions.doctorName, + projectID: prescriptions.projectID), + loading: model.state == ViewState.BusyLocal, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Resend order & deliver', + backgroundColor: Colors.green[200], + )) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/prescriptions/prescriptions_history.dart b/lib/pages/medical/prescriptions/prescriptions_history.dart new file mode 100644 index 00000000..1df9a467 --- /dev/null +++ b/lib/pages/medical/prescriptions/prescriptions_history.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; + +class PrescriptionsHistory extends StatefulWidget { + @override + _PrescriptionsHistoryState createState() => _PrescriptionsHistoryState(); +} + +class _PrescriptionsHistoryState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart new file mode 100644 index 00000000..e4c6ca9f --- /dev/null +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -0,0 +1,122 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class HomePrescriptionsPage extends StatefulWidget { + @override + _HomePrescriptionsPageState createState() => _HomePrescriptionsPageState(); +} + +class _HomePrescriptionsPageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPrescriptions(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'My Doctors', + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Stack( + children: [ + Positioned( + bottom: 1, + left: 0, + right: 0, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + color: Theme.of(context) + .scaffoldBackgroundColor + .withOpacity(0.8), + height: 70.0, + ), + ), + ), + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.7), + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.label, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: Texts('Prescriptions'), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: Texts('History'), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PrescriptionsPage(prescriptionsViewModel: model,), + PrescriptionsHistory() + ], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart new file mode 100644 index 00000000..e335f41c --- /dev/null +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -0,0 +1,102 @@ +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionsPage extends StatelessWidget { + final PrescriptionsViewModel prescriptionsViewModel; + + const PrescriptionsPage({Key key, this.prescriptionsViewModel}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return AppScaffold( + baseViewModel: prescriptionsViewModel, + body: FractionallySizedBox( + widthFactor: 1.0, + child: ListView( + physics: BouncingScrollPhysics(), + children: [ + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () => + prescriptionsViewModel.setFilterType(FilterType.Clinic), + child: ListTile( + title: const Text('Clinic'), + leading: Radio( + value: FilterType.Clinic, + groupValue: prescriptionsViewModel.filterType, + activeColor: Colors.red[800], + onChanged: (FilterType value) { + prescriptionsViewModel.setFilterType(value); + }, + ), + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => prescriptionsViewModel + .setFilterType(FilterType.Hospital), + child: ListTile( + title: const Text('Hospital'), + leading: Radio( + value: FilterType.Hospital, + groupValue: prescriptionsViewModel.filterType, + activeColor: Colors.red[800], + onChanged: (FilterType value) { + prescriptionsViewModel.setFilterType(value); + }, + ), + ), + ), + ) + ], + ), + ...List.generate( + prescriptionsViewModel.prescriptionsOrderList.length, + (index) => AppExpandableNotifier( + title: prescriptionsViewModel + .prescriptionsOrderList[index].filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: prescriptionsViewModel + .prescriptionsOrderList[index].prescriptionsList + .map((prescriptions) { + return InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage(prescriptions: prescriptions,), + ), + ), + child: DoctorCard( + name: prescriptions.doctorName, + profileUrl: prescriptions.doctorImageURL, + rat: prescriptions.doctorRate.toDouble(), + subName: prescriptions.name, + date: DateUtil.getMonthDayYearDateFormatted( + prescriptions.dischargeDate), + ), + ); + }).toList(), + )), + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index d63babb5..f8aff960 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -13,6 +13,7 @@ class Button extends StatefulWidget { this.label: "", this.icon, this.onTap, + this.backgroundColor, this.loading: false, this.elevation: true}) : super(key: key); @@ -22,6 +23,7 @@ class Button extends StatefulWidget { final VoidCallback onTap; final bool loading; final bool elevation; + final Color backgroundColor; @override _ButtonState createState() => _ButtonState(); @@ -103,7 +105,7 @@ class _ButtonState extends State