diff --git a/lib/config/config.dart b/lib/config/config.dart index f1a58489..92291ed3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -3,7 +3,7 @@ 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"; const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -50,7 +50,7 @@ var SERVICES_PATIANT_HEADER = [ //****************** // Colors ////// by : ibrahim -const PRIMARY_COLOR = 0xf5f5f5; +const PRIMARY_COLOR = 0xff515B5D; const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; 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/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 428de7c5..0014432c 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -86,20 +86,20 @@ class _ProgressNoteState extends State { ? DrAppEmbeddedError( error: 'You don\'t have any Progress Note') : Column( - children: [ - Container( - width: SizeConfig.screenWidth * 0.80, - margin: EdgeInsets.all(20), - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, 'Search Patient'), - ), - ), - Expanded( + 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, @@ -107,82 +107,95 @@ class _ProgressNoteState extends State { SizeConfig.realScreenWidth * 0.05, 0), child: ListView.builder( - itemCount: - notesList.length, + itemCount: notesList.length, itemBuilder: (BuildContext ctxt, int index) { return RoundedContainer( - backgroundColor: Colors.yellow[200], + backgroundColor: Colors.white, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + 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], + 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, + ) + ], ), - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - AppText( - notesList[index] - ["Notes"], - margin: 10, - ) ], )); }), ), - ), - ], - ), + ), + ], + ), ); } - + InputDecoration buildInputDecoration(BuildContext context, hint) { return InputDecoration( - prefixIcon: Icon(Icons.search, color:Colors.black), + 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)), + borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Hexcolor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(50.0)), + 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; - }); - } + 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) {