From 091234ad773cc35fb9fc0c9971930eed440549ec Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 24 Mar 2021 14:14:37 +0300 Subject: [PATCH] bug fix --- lib/config/config.dart | 4 +- lib/core/service/patient_service.dart | 2 +- lib/models/patient/patient_model.dart | 98 +++++++++++------------ lib/screens/patients/patients_screen.dart | 42 ++++++---- 4 files changed, 77 insertions(+), 69 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 56fe8bff..56cd8d6c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index 8370287a..4f190ff8 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -128,7 +128,7 @@ class PatientService extends BaseService { "TokenID": patient.TokenID, "SessionID": patient.SessionID, "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, - "PatientOutSA": patient.PatientOutSA + "PatientOutSA": patient.PatientOutSA, }, ); diff --git a/lib/models/patient/patient_model.dart b/lib/models/patient/patient_model.dart index c6f4602d..08b5d1d0 100644 --- a/lib/models/patient/patient_model.dart +++ b/lib/models/patient/patient_model.dart @@ -1,4 +1,3 @@ - /* *@author:Modified by amjad add getter and setter Amjad Amireh *@Date:11/5/2020 @@ -29,91 +28,88 @@ class PatientModel { String SessionID; bool IsLoginForDoctorApp; bool PatientOutSA; + int Searchtype; + int get getProjectID => ProjectID; - int get getProjectID => ProjectID; - - set setProjectID(int ProjectID) => this.ProjectID = ProjectID; + set setProjectID(int ProjectID) => this.ProjectID = ProjectID; - int get getClinicID => ClinicID; + int get getClinicID => ClinicID; - set setClinicID(int ClinicID) => this.ClinicID = ClinicID; + set setClinicID(int ClinicID) => this.ClinicID = ClinicID; - int get getDoctorID => DoctorID; + int get getDoctorID => DoctorID; - set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; + set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; String get getFirstName => FirstName; - set setFirstName(String FirstName) => this.FirstName = FirstName; + set setFirstName(String FirstName) => this.FirstName = FirstName; - String get getMiddleName => MiddleName; + String get getMiddleName => MiddleName; - set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; + set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; - String get getLastName => LastName; + String get getLastName => LastName; - set setLastName(String LastName) => this.LastName = LastName; + set setLastName(String LastName) => this.LastName = LastName; - String get getPatientMobileNumber => PatientMobileNumber; + String get getPatientMobileNumber => PatientMobileNumber; - set setPatientMobileNumber(String PatientMobileNumber) => this.PatientMobileNumber = PatientMobileNumber; + set setPatientMobileNumber(String PatientMobileNumber) => + this.PatientMobileNumber = PatientMobileNumber; // String get getPatientIdentificationID => PatientIdentificationID; // set setPatientIdentificationID(String PatientIdentificationID) => this.PatientIdentificationID = PatientIdentificationID; - int get getPatientID => PatientID; - - set setPatientID(int PatientID) => this.PatientID = PatientID; - - String get getFrom => From; + int get getPatientID => PatientID; - set setFrom(String From) => this.From = From; + set setPatientID(int PatientID) => this.PatientID = PatientID; - String get getTo => To; + String get getFrom => From; - set setTo(String To) => this.To = To; + set setFrom(String From) => this.From = From; - int get getLanguageID => LanguageID; + String get getTo => To; - set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; + set setTo(String To) => this.To = To; - String get getStamp => stamp; + int get getLanguageID => LanguageID; - set setStamp(String stamp) => this.stamp = stamp; + set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; - String get getIPAdress => IPAdress; + String get getStamp => stamp; - set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; + set setStamp(String stamp) => this.stamp = stamp; - double get getVersionID => VersionID; + String get getIPAdress => IPAdress; - set setVersionID(double VersionID) => this.VersionID = VersionID; + set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; - int get getChannel => Channel; + double get getVersionID => VersionID; - set setChannel(int Channel) => this.Channel = Channel; + set setVersionID(double VersionID) => this.VersionID = VersionID; - String get getTokenID => TokenID; + int get getChannel => Channel; - set setTokenID(String TokenID) => this.TokenID = TokenID; + set setChannel(int Channel) => this.Channel = Channel; - String get getSessionID => SessionID; + String get getTokenID => TokenID; - set setSessionID(String SessionID) => this.SessionID = SessionID; + set setTokenID(String TokenID) => this.TokenID = TokenID; - bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; - - set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => this.IsLoginForDoctorApp = IsLoginForDoctorApp; - - bool get getPatientOutSA => PatientOutSA; - - set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; + String get getSessionID => SessionID; + set setSessionID(String SessionID) => this.SessionID = SessionID; + bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; + set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => + this.IsLoginForDoctorApp = IsLoginForDoctorApp; + bool get getPatientOutSA => PatientOutSA; + set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; PatientModel( {this.ProjectID, @@ -135,15 +131,13 @@ class PatientModel { this.TokenID, this.SessionID, this.IsLoginForDoctorApp, - this.PatientOutSA}); - + this.PatientOutSA, + this.Searchtype}); - factory PatientModel.fromJson(Map json) => PatientModel( - + factory PatientModel.fromJson(Map json) => PatientModel( FirstName: json["FirstName"], - LastName: json["LasttName"], - - ); + LastName: json["LasttName"], + ); Map toJson() { final Map data = new Map(); data['ProjectID'] = this.ProjectID; @@ -167,8 +161,8 @@ class PatientModel { data['SessionID'] = this.SessionID; data['IsLoginForDoctorApp'] = this.IsLoginForDoctorApp; data['PatientOutSA'] = this.PatientOutSA; + data['Searchtype'] = this.Searchtype; return data; } } //*************************** - \ No newline at end of file diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index acd5dfa9..56935a8e 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -79,7 +79,7 @@ class _PatientsScreenState extends State { String error = ""; String arrivalType; ProjectViewModel projectsProvider; - + var isView; final _controller = TextEditingController(); PatientModel patient; @@ -239,6 +239,10 @@ class _PatientsScreenState extends State { if (routeArgs != null && routeArgs.containsKey("isSearch")) { isSearch = routeArgs['isSearch']; } + if (routeArgs != null && routeArgs.containsKey("isSearch")) { + isView = routeArgs['isView']; + patient.Searchtype = 1; + } if (!projectsProvider.isArabic) patientTypeTitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; @@ -265,7 +269,7 @@ class _PatientsScreenState extends State { ? getPatientArrivalListRequestModel.toJson() : patient, patientType, - isView: widget.isView) + isView: isView) .then((res) { setState(() { if (res != null && res['MessageStatus'] == 1) { @@ -289,24 +293,34 @@ class _PatientsScreenState extends State { lItems = localList; } } else { + if (isView == false && val2 == 1) { + lItems = res['GetPatientFileInformation_PRMList']; + } lItems = res[SERVICES_PATIANT2[val2]]; } parsed = lItems; responseModelList = new ModelResponse.fromJson(parsed).list; + //if (val2 == 7) { responseModelList.sort((a, b) { - DateTime now = DateTime.now(); - DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm"); - String formattedDate = - DateFormat('yyyy-MM-dd ' + a.startTime).format(now); - DateTime dateTimeA = dateFormat.parse(formattedDate); - String formattedDateB = - DateFormat('yyyy-MM-dd ' + b.startTime).format(now); - DateTime dateTimeB = dateFormat.parse(formattedDateB); - var adate = dateTimeA; //a.startTime; - var bdate = dateTimeB; - return adate.compareTo(bdate); + if (b.startTime != null && b.startTime != null) { + DateTime now = DateTime.now(); + DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm"); + String formattedDate = + DateFormat('yyyy-MM-dd ' + a.startTime).format(now); + DateTime dateTimeA = dateFormat.parse(formattedDate); + String formattedDateB = + DateFormat('yyyy-MM-dd ' + b.startTime).format(now); + DateTime dateTimeB = dateFormat.parse(formattedDateB); + var adate = dateTimeA; //a.startTime; + var bdate = dateTimeB; + return adate.compareTo(bdate); + } else { + var adate = convertDateFormat(a.appointmentDate); + var bdate = convertDateFormat(b.appointmentDate); + return bdate.compareTo(adate); + } }); - + //} responseModelList2 = responseModelList; _isError = false; } else {