diff --git a/lib/config/config.dart b/lib/config/config.dart index 24c2586a..63d5545f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,7 +2,7 @@ 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/Services/'; const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; @@ -50,7 +50,7 @@ var SERVICES_PATIANT_HEADER = [ //****************** // Colors ////// by : ibrahim -const PRIMARY_COLOR = 0xff58434F; +const PRIMARY_COLOR = 0xff515B5D; const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; diff --git a/lib/models/my_referred_patient_model.dart b/lib/models/my_referred_patient_model.dart new file mode 100644 index 00000000..9ecfdb2f --- /dev/null +++ b/lib/models/my_referred_patient_model.dart @@ -0,0 +1,221 @@ + +import 'dart:convert'; + +import 'package:doctor_app_flutter/util/helpers.dart'; + +MyReferredPatientModel myReferredPatientModelFromJson(String str) => MyReferredPatientModel.fromJson(json.decode(str)); + +String myReferredPatientModelToJson(MyReferredPatientModel data) => json.encode(data.toJson()); + +class MyReferredPatientModel { + MyReferredPatientModel({ + this.projectId, + this.lineItemNo, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.nationalityName, + this.nationalityNameN, + this.clinicDescription, + this.clinicDescriptionN, + this.referralDoctor, + this.referringDoctor, + this.referralClinic, + this.referringClinic, + this.referralStatus, + this.referralDate, + this.referringDoctorRemarks, + this.referredDoctorRemarks, + this.referralResponseOn, + this.priority, + this.frequency, + this.maxResponseTime, + this.dischargeDate, + this.age, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nursingStationName, + this.priorityDescription, + this.referralClinicDescription, + this.referralDoctorName, + }); + + int projectId; + int lineItemNo; + int doctorId; + int patientId; + String doctorName; + dynamic doctorNameN; + String firstName; + String middleName; + String lastName; + dynamic firstNameN; + dynamic middleNameN; + dynamic lastNameN; + int gender; + String dateofBirth; + String mobileNumber; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomId; + String bedId; + dynamic nursingStationId; + dynamic description; + String nationalityName; + dynamic nationalityNameN; + String clinicDescription; + dynamic clinicDescriptionN; + int referralDoctor; + int referringDoctor; + int referralClinic; + int referringClinic; + int referralStatus; + String referralDate; + String referringDoctorRemarks; + String referredDoctorRemarks; + String referralResponseOn; + int priority; + int frequency; + DateTime maxResponseTime; + dynamic dischargeDate; + String age; + String frequencyDescription; + String genderDescription; + bool isDoctorLate; + bool isDoctorResponse; + String nursingStationName; + String priorityDescription; + String referralClinicDescription; + String referralDoctorName; + + factory MyReferredPatientModel.fromJson(Map json) => MyReferredPatientModel( + projectId: json["ProjectID"], + lineItemNo: json["LineItemNo"], + doctorId: json["DoctorID"], + patientId: json["PatientID"], + doctorName: json["DoctorName"], + doctorNameN: json["DoctorNameN"], + firstName: json["FirstName"], + middleName: json["MiddleName"], + lastName: json["LastName"], + firstNameN: json["FirstNameN"], + middleNameN: json["MiddleNameN"], + lastNameN: json["LastNameN"], + gender: json["Gender"], + dateofBirth: json["DateofBirth"], + mobileNumber: json["MobileNumber"], + emailAddress: json["EmailAddress"], + patientIdentificationNo: json["PatientIdentificationNo"], + patientType: json["PatientType"], + admissionNo: json["AdmissionNo"], + admissionDate: json["AdmissionDate"], + roomId: json["RoomID"], + bedId: json["BedID"], + nursingStationId: json["NursingStationID"], + description: json["Description"], + nationalityName: json["NationalityName"], + nationalityNameN: json["NationalityNameN"], + clinicDescription: json["ClinicDescription"], + clinicDescriptionN: json["ClinicDescriptionN"], + referralDoctor: json["ReferralDoctor"], + referringDoctor: json["ReferringDoctor"], + referralClinic: json["ReferralClinic"], + referringClinic: json["ReferringClinic"], + referralStatus: json["ReferralStatus"], + referralDate: json["ReferralDate"], + referringDoctorRemarks: json["ReferringDoctorRemarks"], + referredDoctorRemarks: json["ReferredDoctorRemarks"], + referralResponseOn: json["ReferralResponseOn"], + priority: json["Priority"], + frequency: json["Frequency"], + maxResponseTime: Helpers.convertStringToDate(json['MAXResponseTime']),//json["MAXResponseTime"], + dischargeDate: json["DischargeDate"], + age: json["Age"], + frequencyDescription: json["FrequencyDescription"], + genderDescription: json["GenderDescription"], + isDoctorLate: json["IsDoctorLate"], + isDoctorResponse: json["IsDoctorResponse"], + nursingStationName: json["NursingStationName"], + priorityDescription: json["PriorityDescription"], + referralClinicDescription: json["ReferralClinicDescription"], + referralDoctorName: json["ReferralDoctorName"], + ); + + Map toJson() => { + "ProjectID": projectId, + "LineItemNo": lineItemNo, + "DoctorID": doctorId, + "PatientID": patientId, + "DoctorName": doctorName, + "DoctorNameN": doctorNameN, + "FirstName": firstName, + "MiddleName": middleName, + "LastName": lastName, + "FirstNameN": firstNameN, + "MiddleNameN": middleNameN, + "LastNameN": lastNameN, + "Gender": gender, + "DateofBirth": dateofBirth, + "MobileNumber": mobileNumber, + "EmailAddress": emailAddress, + "PatientIdentificationNo": patientIdentificationNo, + "PatientType": patientType, + "AdmissionNo": admissionNo, + "AdmissionDate": admissionDate, + "RoomID": roomId, + "BedID": bedId, + "NursingStationID": nursingStationId, + "Description": description, + "NationalityName": nationalityName, + "NationalityNameN": nationalityNameN, + "ClinicDescription": clinicDescription, + "ClinicDescriptionN": clinicDescriptionN, + "ReferralDoctor": referralDoctor, + "ReferringDoctor": referringDoctor, + "ReferralClinic": referralClinic, + "ReferringClinic": referringClinic, + "ReferralStatus": referralStatus, + "ReferralDate": referralDate, + "ReferringDoctorRemarks": referringDoctorRemarks, + "ReferredDoctorRemarks": referredDoctorRemarks, + "ReferralResponseOn": referralResponseOn, + "Priority": priority, + "Frequency": frequency, + "MAXResponseTime": maxResponseTime, + "DischargeDate": dischargeDate, + "Age": age, + "FrequencyDescription": frequencyDescription, + "GenderDescription": genderDescription, + "IsDoctorLate": isDoctorLate, + "IsDoctorResponse": isDoctorResponse, + "NursingStationName": nursingStationName, + "PriorityDescription": priorityDescription, + "ReferralClinicDescription": referralClinicDescription, + "ReferralDoctorName": referralDoctorName, + }; +} + diff --git a/lib/models/patient/insurance_aprovals_request.dart b/lib/models/patient/insurance_aprovals_request.dart index b94b9b9b..e36355d8 100644 --- a/lib/models/patient/insurance_aprovals_request.dart +++ b/lib/models/patient/insurance_aprovals_request.dart @@ -46,7 +46,7 @@ class InsuranceAprovalsRequest { this.stamp = '2020-04-23T21:01:21.492Z', this.ipAdress = '11.11.11.11', this.versionID = 1.2, - this.tokenID = '@dm!n', + this.tokenID , this.sessionID = 'e29zoooEJ4', this.isLoginForDoctorApp = true, this.patientOutSA = false}); diff --git a/lib/models/patient/orders_request.dart b/lib/models/patient/orders_request.dart index 92df2ab9..5e1283fa 100644 --- a/lib/models/patient/orders_request.dart +++ b/lib/models/patient/orders_request.dart @@ -45,7 +45,7 @@ class OrdersRequest { this.languageID = 2, this.iPAdress = '11.11.11.11', this.channel = 9, - this.tokenID = '@dm!n', + this.tokenID , this.sessionID = "LlBk8lUEJY", this.isLoginForDoctorApp = true, this.patientTypeID = 1, diff --git a/lib/models/patient/progress_note_request.dart b/lib/models/patient/progress_note_request.dart index 87e2bf66..ce38b56e 100644 --- a/lib/models/patient/progress_note_request.dart +++ b/lib/models/patient/progress_note_request.dart @@ -45,7 +45,7 @@ class ProgressNoteRequest { this.languageID = 2, this.iPAdress = '11.11.11.11', this.channel = 9, - this.tokenID = '@dm!n', + this.tokenID , this.sessionID = "LlBk8lUEJY", this.isLoginForDoctorApp = true, this.patientTypeID = 1, diff --git a/lib/models/request_add_referred_doctor_remarks.dart b/lib/models/request_add_referred_doctor_remarks.dart index 0799c7ba..b396c47f 100644 --- a/lib/models/request_add_referred_doctor_remarks.dart +++ b/lib/models/request_add_referred_doctor_remarks.dart @@ -17,6 +17,7 @@ class RequestAddReferredDoctorRemarks { String sessionID; bool isLoginForDoctorApp; bool patientOutSA; + RequestAddReferredDoctorRemarks( {this.projectID, diff --git a/lib/models/verify_referral_doctor_remarks.dart b/lib/models/verify_referral_doctor_remarks.dart new file mode 100644 index 00000000..b9bfce0a --- /dev/null +++ b/lib/models/verify_referral_doctor_remarks.dart @@ -0,0 +1,103 @@ +import 'package:doctor_app_flutter/config/config.dart'; + +class VerifyReferralDoctorRemarks { + int projectID; + String admissionNo; + int lineItemNo; + String referredDoctorRemarks; + int editedBy; + int patientID; + int referringDoctor; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String firstName; + + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + + VerifyReferralDoctorRemarks( + {this.projectID, + this.admissionNo, + this.lineItemNo, + this.referredDoctorRemarks, + this.editedBy, + this.patientID, + this.referringDoctor, + this.languageID = LANGUAGE_ID, + this.stamp = STAMP, + this.iPAdress = IP_ADDRESS, + this.versionID = VERSION_ID, + this.channel= CHANNEL, + this.tokenID, + this.sessionID = SESSION_ID, + this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, + this.patientOutSA = PATIENT_OUT_SA, + this.firstName, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + }); + + VerifyReferralDoctorRemarks.fromJson(Map json) { + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + lineItemNo = json['LineItemNo']; + referredDoctorRemarks = json['ReferredDoctorRemarks']; + editedBy = json['EditedBy']; + patientID = json['PatientID']; + referringDoctor = json['ReferringDoctor']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + firstName= json["FirstName"]; + middleName= json["MiddleName"]; + lastName= json["LastName"]; + patientMobileNumber= json["PatientMobileNumber"]; + patientIdentificationID = json["PatientIdentificationID"]; + + + + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['LineItemNo'] = this.lineItemNo; + data['ReferredDoctorRemarks'] = this.referredDoctorRemarks; + data['EditedBy'] = this.editedBy; + data['PatientID'] = this.patientID; + data['ReferringDoctor'] = this.referringDoctor; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + return data; + } +} diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 864c4d72..a2bcdf93 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -339,6 +339,9 @@ class PatientsProvider with ChangeNotifier { getPatientInsuranceApprovals(patient) async { //setBasicData(); + getPatientInsuranceApprovals(patient) async{ + + setBasicData(); try { if (await Helpers.checkConnection()) { final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL, diff --git a/lib/providers/referred_patient_provider.dart b/lib/providers/referred_patient_provider.dart new file mode 100644 index 00000000..0f3e6741 --- /dev/null +++ b/lib/providers/referred_patient_provider.dart @@ -0,0 +1,96 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +//import 'package:doctor_app_flutter/models/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/my_referred_patient_model.dart'; +//import 'package:doctor_app_flutter/models/my_referred_patient_model.dart'; +//import 'package:doctor_app_flutter/models/request_add_referred_doctor_remarks.dart'; +import 'package:doctor_app_flutter/models/request_my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/verify_referral_doctor_remarks.dart'; +import 'package:flutter/cupertino.dart'; + + +class MyReferredPatientProvider with ChangeNotifier { + List listMyReferredPatientModel = []; + + bool isLoading = true; + bool isError = false; + String error = ''; + + RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); + // RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); + VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = VerifyReferralDoctorRemarks(); + MyReferredPatientProvider() { + getMyReferralPatient(); + } + + getMyReferralPatient() async { + try { + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyReferredPatient', + body: _requestMyReferralPatient.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_MyReferredPatient'].forEach((v) { + listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); + }); + isError = false; + isLoading = false; + }, + onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, + ); + notifyListeners(); + } catch (error) { + isLoading = false; + isError = true; + this.error = 'Something wrong happened, please contact the admin'; + notifyListeners(); + } + } + + // Future replay( + // String referredDoctorRemarks, MyReferredPatientModel model) async { + Future replay( + MyReferredPatientModel model) async { + try { + + _verifyreferraldoctorremarks.patientID=model.projectId; + _verifyreferraldoctorremarks.admissionNo =model.admissionNo; + _verifyreferraldoctorremarks.lineItemNo = model.lineItemNo; + + _verifyreferraldoctorremarks.referredDoctorRemarks=model.referredDoctorRemarks; + _verifyreferraldoctorremarks.referringDoctor=model.referringDoctor; + _verifyreferraldoctorremarks.firstName=model.firstName; + _verifyreferraldoctorremarks.middleName=model.middleName; + _verifyreferraldoctorremarks.lastName=model.lastName; + _verifyreferraldoctorremarks.patientMobileNumber=model.mobileNumber; + _verifyreferraldoctorremarks.patientIdentificationID=model.patientIdentificationNo; + + + + + + + + + + + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyReferredPatient', + body: _verifyreferraldoctorremarks.toJson(),//_requestAddReferredDoctorRemarks.toJson(), + onSuccess: (dynamic body, int statusCode) { + + listMyReferredPatientModel[ + listMyReferredPatientModel.indexOf(model)] = model; + notifyListeners(); + }, + onFailure: (String error, int statusCode) { + throw (error); + }, + ); + } catch (error) { + throw error; + } + } +} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index d2a777f1..fc6ceb54 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/providers/doctor_reply_provider.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/hospital_provider.dart'; import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; +import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -19,6 +20,8 @@ import '../widgets/shared/rounded_container_widget.dart'; import 'doctor/doctor_reply_screen.dart'; import 'doctor/my_referral_patient_screen.dart'; +import 'doctor/my_referred_patient_screen.dart'; + class DashboardScreen extends StatefulWidget { DashboardScreen({Key key, this.title}) : super(key: key); @@ -244,12 +247,12 @@ class _DashboardScreenState extends State { ), ), Expanded( - flex: 2, + flex: 3, child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( - flex: 2, + flex: 1, child: InkWell( child: DashboardItemIconText( DoctorApp.home_icon, @@ -272,7 +275,7 @@ class _DashboardScreenState extends State { ), ), Expanded( - flex: 2, + flex: 1, child: InkWell( onTap: (){ Navigator.push( @@ -294,6 +297,32 @@ class _DashboardScreenState extends State { ), ), ), + + //================== + Expanded( + flex: 1, + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (_) => MyReferredPatientProvider(), + child: MyReferredPatient(), + ), + ), + ); + }, + child: DashboardItemIconText( + DoctorApp.home_icon, + "", + "My Referred Patient", + showBorder: false, + backgroundColor: Colors.orange, + ), + ), + ), + //================== ], ), ), diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart new file mode 100644 index 00000000..009f62ec --- /dev/null +++ b/lib/screens/doctor/my_referred_patient_screen.dart @@ -0,0 +1,67 @@ +import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; +import 'package:doctor_app_flutter/providers/schedule_provider.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/doctor/my_referred_patient_widget.dart'; +import 'package:doctor_app_flutter/widgets/doctor/my_schedule_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../widgets/shared/app_scaffold_widget.dart'; + +class MyReferredPatient extends StatelessWidget { + + MyReferredPatientProvider referredPatientProvider; + + @override + Widget build(BuildContext context) { + referredPatientProvider = Provider.of(context); + return AppScaffold( + showBottomBar: false, + showAppDrawer: false, + appBarTitle: TranslationBase.of(context).mySchedule, + body: referredPatientProvider.isLoading + ? DrAppCircularProgressIndeicator() + : referredPatientProvider.isError + ? Center( + child: AppText( + referredPatientProvider.error, + color: Theme.of(context).errorColor, + ), + ) + : referredPatientProvider.listMyReferralPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : Container( + padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), + child: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Container( + child: Column( + + children: referredPatientProvider.listMyReferralPatientModel.map((item) { + return MyReferredPatientWidget( + myReferredPatientModel: item, + ); + }).toList(), + ), + ), + ], + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 2c0963cd..d00aabdb 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -58,9 +58,8 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { -print("============== _selectedType============"+ _selectedType); - if(_selectedType!='3') - { +//print("============== _selectedType============"+ _selectedType); + try { //==================== @@ -102,15 +101,7 @@ print("============== _selectedType============"+ _selectedType); } catch (err) { handelCatchErrorCase(err); } - } - else - { - Navigator.of(context).pushNamed(PATIENTS_REFERRED, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": _selectedType - }); - - } + } handelCatchErrorCase(err) { diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 87bc84a2..bcdc4218 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -338,14 +338,14 @@ class _PatientsScreenState extends State { ), SizedBox(height: 10.0), Container( - width: SizeConfig.screenWidth * 0.80, + width: SizeConfig.screenWidth * 0.9, child: TextField( controller: _controller, onChanged: (String str) { this.searchData(str); }, decoration: buildInputDecoration( - context, 'Search Patient'), + context, 'Search '), ), ), SizedBox( @@ -385,9 +385,9 @@ class _PatientsScreenState extends State { url + avatarMale, height: - 100.0, + 80.0, width: - 100.0, + 80.0, semanticsLabel: 'Male Logo') ] @@ -402,7 +402,11 @@ class _PatientsScreenState extends State { semanticsLabel: 'Female Logo') ], + ), + SizedBox( + width: 10, + ), Column( crossAxisAlignment: CrossAxisAlignment @@ -412,7 +416,7 @@ class _PatientsScreenState extends State { item.firstName + " " + item.lastName, - fontSize: 2.5 * + fontSize: 2.0 * SizeConfig .textMultiplier, fontWeight: @@ -437,12 +441,10 @@ class _PatientsScreenState extends State { backGroundcolor: Colors.white, ), - SizedBox( - height: 8, - ), - SizedBox( - height: 8, - ), + + // SizedBox( + // height: 8, + // ), AppText( "Age:" + item.age @@ -566,7 +568,7 @@ class _PatientsScreenState extends State { Widget _locationBar(BuildContext _context) { return Container( height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.80, + width: SizeConfig.screenWidth * 0.9, decoration: BoxDecoration( color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), child: Row( @@ -575,30 +577,35 @@ class _PatientsScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: _locations.map((item) { bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ + return Column(mainAxisSize: MainAxisSize.min, + children: [ InkWell( - child: Container( - height: 40, - width: 80, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: _isActive ? Hexcolor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 15, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - // backgroundColor:_isActive - // ? Hexcolor("#B8382B") - // : Colors.white,//sideColor, - - fontWeight: FontWeight.bold), + child: Center( + child: Container( + height: 40, + width: 90, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50), + color: _isActive ? Hexcolor("#B8382B") : Colors.white, ), - )), + child: Center( + child: Text( + item, + + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + // backgroundColor:_isActive + // ? Hexcolor("#B8382B") + // : Colors.white,//sideColor, + + fontWeight: FontWeight.bold, + ), + ), + )), + ), onTap: () { print(_locations.indexOf(item)); @@ -606,7 +613,7 @@ class _PatientsScreenState extends State { setState(() { _activeLocation = _locations.indexOf(item); - // sideColor=Colors.redAccent; + }); }), _isActive @@ -616,7 +623,7 @@ class _PatientsScreenState extends State { color: Colors.white), alignment: Alignment.center, height: 3, - width: 80, + width: 90, ) : Container() ]); diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index d3083f7a..e2d531c5 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -1,7 +1,10 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/insurance_aprovals_request.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../../config/shared_pref_kay.dart'; @@ -30,6 +33,9 @@ class InsuranceApprovalsScreen extends StatefulWidget { class _InsuranceApprovalsState extends State { PatientsProvider patientsProv; + var approvalsList; + var filteredApprovalsList; + final _controller = TextEditingController(); var _isInit = true; /* @@ -46,13 +52,15 @@ class _InsuranceApprovalsState extends State { String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); print(type); - InsuranceAprovalsRequest insuranceApprovalsRequest = InsuranceAprovalsRequest( - patientID: patient.patientId, - projectID: patient.projectId, - tokenID: token, - patientTypeID: patient.patientType, - languageID: 2); - patientsProv.getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()); + InsuranceAprovalsRequest insuranceApprovalsRequest = + InsuranceAprovalsRequest( + patientID: patient.patientId, + projectID: patient.projectId, + tokenID: token, + patientTypeID: patient.patientType, + languageID: 2); + patientsProv + .getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()); } @override @@ -61,8 +69,9 @@ class _InsuranceApprovalsState extends State { if (_isInit) { patientsProv = Provider.of(context); getInsuranceApprovalsList(context); + approvalsList = patientsProv.insuranceApporvalsList; + _isInit = false; } - _isInit = false; } @override @@ -75,62 +84,320 @@ class _InsuranceApprovalsState extends State { ? DrAppCircularProgressIndeicator() : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.insuranceApporvalsList.length == 0 + : patientsProv.insuranceApporvalsList == null ? DrAppEmbeddedError( error: 'You don\'t have any Insurance Approvals') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: - patientsProv.insuranceApporvalsList.length, - itemBuilder: (BuildContext ctxt, int index) { - return RoundedContainer( - backgroundColor: Colors.yellow[200], - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patientsProv - .insuranceApporvalsList[index] - ["ClinicName"]+"-"+patientsProv - .insuranceApporvalsList[index] - ["DoctorName"], - marginTop: 10, - marginLeft: 10, - marginBottom: 5, - fontWeight: FontWeight.bold, - ), - AppText( - convertDateFormat(patientsProv - .insuranceApporvalsList[index] - ["ApprovalDate"]), - marginLeft: 10, - color: Colors.grey[600], - ), - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - AppText( - patientsProv - .insuranceApporvalsList[index] - ["CompanyName"], - margin: 10, - ) - ], - )); - }), + : Column( + children: [ + Container( + margin: EdgeInsets.all(10), + width: SizeConfig.screenWidth * 0.80, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: buildInputDecoration( + context, 'Search Insurance Approvals'), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.realScreenWidth * 0.05, + 0, + SizeConfig.realScreenWidth * 0.05, + 0), + child: ListView.builder( + itemCount: approvalsList.length, + itemBuilder: (BuildContext ctxt, int index) { + return RoundedContainer( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Row( + children: [ + Icon( + approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Approved") + ? Icons.check_circle_outline + : approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Cancelled") + ? Icons.highlight_off + : Icons.history, + color: approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Approved") + ? Colors.green + : approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Cancelled") + ? Colors.red + : Colors.yellow, + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + approvalsList[index] + ["ClinicName"], + marginTop: 10, + marginLeft: 10, + marginBottom: 5, + fontWeight: FontWeight.bold, + ), + AppText( + approvalsList[index] + ["DoctorName"], + marginLeft: 10, + marginTop: 1, + ), + AppText( + convertDateFormat( + approvalsList[index] + ["ApprovalDate"]), + marginLeft: 10, + marginBottom: 5, + color: Colors.grey[600], + ), + ], + ), + ) + ], + ), + children: [ + Divider( + color: Colors.black, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + RoundedContainer( + backgroundColor: + Color(PRIMARY_COLOR), + child: Column( + children: [ + Row( + children: [ + AppText( + "Approval No:", + color: Colors.white, + fontSize: 16, + margin: 10, + ), + AppText( + approvalsList[index] + ["ApprovalNo"] + .toString(), + color: Colors.white, + fontSize: 19, + fontWeight: + FontWeight.bold, + margin: 5, + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + "PRODUCER NAME", + fontSize: 10, + color: Colors.white, + marginLeft: SizeConfig + .widthMultiplier * + 3, + ), + AppText(checkList(approvalsList[index]["ApporvalDetails"])? + approvalsList[index] + [ + "ApporvalDetails"][0] + [ + "ProcedureName"] : "", + fontSize: 12, + fontWeight: FontWeight.bold, + marginLeft: SizeConfig + .widthMultiplier * + 3, + marginTop: 3, + color: Colors.white, + ), + ], + ), + ), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + "STATUS", + fontSize: 10, + color: Colors.white, + marginLeft: SizeConfig + .widthMultiplier * + 9, + ), + AppText( + approvalsList[index] + [ + "ApprovalStatusDescption"], + fontSize: 12, + fontWeight: FontWeight.bold, + marginLeft: SizeConfig + .widthMultiplier * + 9, + marginTop: 3, + color: Colors.white, + ), + ], + ), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + "RECEIPT ON", + fontSize: 10, + color: Colors.white, + marginLeft: SizeConfig + .widthMultiplier * + 3, + marginTop: SizeConfig + .heightMultiplier * + 1.5, + ), + AppText( + convertDateFormat( approvalsList[index] + ["ReceiptOn"]), + fontSize: 12, + fontWeight: FontWeight.bold, + marginLeft: SizeConfig + .widthMultiplier * + 3, + marginTop: 3, + marginBottom: SizeConfig.heightMultiplier*2, + color: Colors.white, + ), + ], + ), + ), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + "EXPIRY DATE", + fontSize: 10, + color: Colors.white, + marginTop: SizeConfig + .heightMultiplier * + 1.5, + marginLeft: SizeConfig + .widthMultiplier * + 9, + ), + AppText( + convertDateFormat( + approvalsList[ + index][ + "ExpiryDate"]), + fontSize: 12, + fontWeight: FontWeight.bold, + marginLeft: SizeConfig + .widthMultiplier * + 9, + marginTop: 3, + marginBottom: SizeConfig.heightMultiplier*2, + color: Colors.white, + ), + ], + ), + ), + ], + ), + ], + )), + ], + ), + ], + )); + }), + ), + ), + ], ), ); } + InputDecoration buildInputDecoration(BuildContext context, hint) { + return InputDecoration( + prefixIcon: Icon(Icons.search, color: Colors.black), + filled: true, + fillColor: Colors.white, + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Colors.grey), //), + )); + } + + searchData(String str) { + var strExist = str.length > 0 ? true : false; + + if (strExist) { + filteredApprovalsList = null; + filteredApprovalsList = approvalsList + .where((note) => + note["ClinicName"].toString().contains(str.toUpperCase())) + .toList(); + setState(() { + approvalsList = filteredApprovalsList; + }); + } else { + setState(() { + approvalsList = patientsProv.insuranceApporvalsList; + }); + } + } + convertDateFormat(String str) { const start = "/Date("; const end = "+0300)"; @@ -148,4 +415,7 @@ class _InsuranceApprovalsState extends State { return newDate.toString(); } + bool checkList(List list){ + return list.length > 0 ? true : false; + } } diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index d05a7504..b602fea7 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -1,7 +1,9 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../../config/shared_pref_kay.dart'; @@ -30,6 +32,9 @@ class PatientsOrdersScreen extends StatefulWidget { class _PatientsOrdersState extends State { PatientsProvider patientsProv; + var notesList; + var filteredNotesList; + final _controller = TextEditingController(); var _isInit = true; /* @@ -47,7 +52,7 @@ class _PatientsOrdersState extends State { print(type); ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( - visitType: 3, // if equal 3 then this will return orders + visitType: 3, // if equal 3 then this will return orders admissionNo: int.parse(patient.admissionNo), projectID: patient.projectId, tokenID: token, @@ -62,6 +67,7 @@ class _PatientsOrdersState extends State { if (_isInit) { patientsProv = Provider.of(context); getProgressNoteList(context); + notesList = patientsProv.patientProgressNoteList; } _isInit = false; } @@ -76,60 +82,122 @@ class _PatientsOrdersState extends State { ? DrAppCircularProgressIndeicator() : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientProgressNoteList.length == 0 + : notesList == null ? DrAppEmbeddedError( - error: 'You don\'t have any Orders') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: - patientsProv.patientProgressNoteList.length, - itemBuilder: (BuildContext ctxt, int index) { - return RoundedContainer( - - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patientsProv - .patientProgressNoteList[index] - ["DoctorName"], - marginTop: 10, - marginLeft: 10, - marginBottom: 5, - fontWeight: FontWeight.bold, - ), - AppText( - convertDateFormat(patientsProv - .patientProgressNoteList[index] - ["AssessmentDate"]), - marginLeft: 10, - color: Colors.grey[600], - ), - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - AppText( - patientsProv - .patientProgressNoteList[index] - ["Notes"], - margin: 10, - ) - ], - )); - }), + error: 'You don\'t have any Orders') + : Column( + children: [ + Container( + margin: EdgeInsets.all(10), + width: SizeConfig.screenWidth * 0.80, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: + buildInputDecoration(context, 'Search Orders'), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.realScreenWidth * 0.05, + 0, + SizeConfig.realScreenWidth * 0.05, + 0), + child: ListView.builder( + itemCount: notesList.length, + itemBuilder: (BuildContext ctxt, int index) { + return RoundedContainer( + backgroundColor: Colors.white, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + notesList[index] + ["DoctorName"], + marginTop: 10, + marginLeft: 10, + marginBottom: 5, + fontWeight: FontWeight.bold, + ), + AppText( + convertDateFormat( + notesList[index] + ["AssessmentDate"]), + marginLeft: 10, + color: Colors.grey[600], + ), + ], + ), + ), + children: [ + Divider( + color: Colors.black, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + AppText( + notesList[index]["Notes"], + margin: 5, + ) + ], + ), + ], + )); + }), + ), + ), + ], ), ); } + InputDecoration buildInputDecoration(BuildContext context, hint) { + return InputDecoration( + prefixIcon: Icon(Icons.search, color: Colors.black), + filled: true, + fillColor: Colors.white, + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(50.0)), + borderSide: BorderSide(color: Colors.grey), //), + )); + } + + searchData(String str) { + var strExist = str.length > 0 ? true : false; + + if (strExist) { + filteredNotesList = null; + filteredNotesList = notesList + .where((note) => + note["DoctorName"].toString().contains(str.toUpperCase())) + .toList(); + setState(() { + notesList = filteredNotesList; + }); + } else { + setState(() { + notesList = patientsProv.patientProgressNoteList; + }); + } + } + convertDateFormat(String str) { const start = "/Date("; const end = "+0300)"; diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index 7381e85b..0014432c 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -1,7 +1,9 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../../config/shared_pref_kay.dart'; @@ -30,6 +32,9 @@ class ProgressNoteScreen extends StatefulWidget { class _ProgressNoteState extends State { PatientsProvider patientsProv; + var notesList; + var filteredNotesList; + final _controller = TextEditingController(); var _isInit = true; /* @@ -62,6 +67,7 @@ class _ProgressNoteState extends State { if (_isInit) { patientsProv = Provider.of(context); getProgressNoteList(context); + notesList = patientsProv.patientProgressNoteList; } _isInit = false; } @@ -76,60 +82,122 @@ class _ProgressNoteState extends State { ? DrAppCircularProgressIndeicator() : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientProgressNoteList.length == 0 + : notesList == null ? DrAppEmbeddedError( error: 'You don\'t have any Progress Note') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: - patientsProv.patientProgressNoteList.length, - itemBuilder: (BuildContext ctxt, int index) { - return RoundedContainer( - backgroundColor: Colors.yellow[200], - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patientsProv - .patientProgressNoteList[index] - ["DoctorName"], - marginTop: 10, - marginLeft: 10, - marginBottom: 5, - fontWeight: FontWeight.bold, - ), - AppText( - convertDateFormat(patientsProv - .patientProgressNoteList[index] - ["AssessmentDate"]), - marginLeft: 10, - color: Colors.grey[600], - ), - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - AppText( - patientsProv - .patientProgressNoteList[index] - ["Notes"], - margin: 10, - ) - ], - )); - }), + : Column( + children: [ + Container( + margin: EdgeInsets.all(10), + width: SizeConfig.screenWidth * 0.80, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: + buildInputDecoration(context, 'Search Note'), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.realScreenWidth * 0.05, + 0, + SizeConfig.realScreenWidth * 0.05, + 0), + child: ListView.builder( + itemCount: notesList.length, + itemBuilder: (BuildContext ctxt, int index) { + return RoundedContainer( + backgroundColor: Colors.white, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + notesList[index] + ["DoctorName"], + marginTop: 10, + marginLeft: 10, + marginBottom: 5, + fontWeight: FontWeight.bold, + ), + AppText( + convertDateFormat( + notesList[index] + ["AssessmentDate"]), + marginLeft: 10, + color: Colors.grey[600], + ), + ], + ), + ), + children: [ + Divider( + color: Colors.black, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + AppText( + notesList[index]["Notes"], + margin: 5, + ) + ], + ), + ], + )); + }), + ), + ), + ], ), ); } + InputDecoration buildInputDecoration(BuildContext context, hint) { + return InputDecoration( + prefixIcon: Icon(Icons.search, color: Colors.black), + filled: true, + fillColor: Colors.white, + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Colors.grey), //), + )); + } + + searchData(String str) { + var strExist = str.length > 0 ? true : false; + + if (strExist) { + filteredNotesList = null; + filteredNotesList = notesList + .where((note) => + note["DoctorName"].toString().contains(str.toUpperCase())) + .toList(); + setState(() { + notesList = filteredNotesList; + }); + } else { + setState(() { + notesList = patientsProv.patientProgressNoteList; + }); + } + } + convertDateFormat(String str) { const start = "/Date("; const end = "+0300)"; diff --git a/lib/widgets/doctor/my_referred_patient_widget.dart b/lib/widgets/doctor/my_referred_patient_widget.dart new file mode 100644 index 00000000..0998788a --- /dev/null +++ b/lib/widgets/doctor/my_referred_patient_widget.dart @@ -0,0 +1,348 @@ + +import 'package:doctor_app_flutter/models/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/my_referred_patient_model.dart'; +import 'package:flutter/material.dart'; + + +import 'package:doctor_app_flutter/config/size_config.dart'; + +import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; + +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/cupertino.dart'; + +import 'package:provider/provider.dart'; + + + +class MyReferredPatientWidget extends StatefulWidget { + +final MyReferredPatientModel myReferredPatientModel; + + MyReferredPatientWidget({Key key, this.myReferredPatientModel}); + + @override + _MyReferredPatientWidgetState createState() => _MyReferredPatientWidgetState(); + + + +} + +class _MyReferredPatientWidgetState extends State { + + bool _showDetails = false; + bool _isLoading = false; + final _formKey = GlobalKey(); + String error; + TextEditingController answerController; + + @override + void initState() { + + + super.initState(); + + } + + @override + Widget build(BuildContext context) { + return CardWithBgWidgetNew( + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + AppText( + '${widget.myReferredPatientModel.firstName} ${widget.myReferredPatientModel.lastName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'File No', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferredPatientModel.patientId}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Referral Doctor', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Texts( + widget.myReferredPatientModel + .referralDoctorName, + maxLength: 80, + readMore: true, + ), + + ], + ), + ), + ], + ), + + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Clinic', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferredPatientModel.referralClinicDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Frequency', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + widget.myReferredPatientModel + .frequencyDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + ], + ), + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Priority', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferredPatientModel.priorityDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Max Response Time', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + Helpers.getDateFormatted(widget + .myReferredPatientModel + .maxResponseTime), + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + ], + ), + Divider(color: Colors.grey), + AppText( + 'Clinic Details and Remarks', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + + SizedBox( + height: 5, + ), + + Texts( + '${widget.myReferredPatientModel.referringDoctorRemarks}', + style: "bodyText1", + readMore: true, + textAlign: TextAlign.start, + maxLength: 100), + SizedBox( + height: 5, + ), + AppText( + 'Answer/Suggestions', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), + + Texts( + '${widget.myReferredPatientModel.referredDoctorRemarks}', + style: "bodyText1", + readMore: true, + textAlign: TextAlign.start, + maxLength: 100), + SizedBox( + height: 5, + ), + + SizedBox(height: 10.0), + if (error != null && error.isNotEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context) + .errorColor + .withOpacity(0.06), + ), + padding: EdgeInsets.symmetric( + vertical: 8.0, horizontal: 12.0), + child: Row( + children: [ + Expanded( + child: Texts(error ?? "", + style: "bodyText1", + color: Theme.of(context) + .errorColor)), + ], + ), + ), + SizedBox(height: 10.0), + ], + ), + SizedBox(height: 10.0), + Container( + width: double.infinity, + child: Button( + onTap: () async { + final form = _formKey.currentState; + + try { + await Provider.of(context, listen: false).replay(widget.myReferredPatientModel); + + setState(() { + _isLoading = false; + }); + } catch (e) { + setState(() { + error = e.toString(); + _isLoading = false; + }); + } + + }, + title: 'Verify', + loading: _isLoading, + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + } +} \ No newline at end of file