edit patient search

merge-requests/65/head
her_username 6 years ago
parent 111d90d56f
commit 312a4741a0

@ -11,8 +11,8 @@ import '../models/list_doctor_working_hours_table_model.dart';
import '../models/request_schedule.dart'; import '../models/request_schedule.dart';
class ScheduleProvider with ChangeNotifier { class ScheduleProvider with ChangeNotifier {
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
List<ListDoctorWorkingHoursTable> listDoctorWorkingHoursTable = []; List<ListDoctorWorkingHoursTable> listDoctorWorkingHoursTable = [];
bool isLoading = true; bool isLoading = true;

@ -1,9 +1,11 @@
import 'package:barcode_scan/platform_wrapper.dart'; import 'package:barcode_scan/platform_wrapper.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart';
import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
@ -20,11 +22,13 @@ class QrReaderScreen extends StatefulWidget {
} }
class _QrReaderScreenState extends State<QrReaderScreen> { class _QrReaderScreenState extends State<QrReaderScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
bool isLoading = false; bool isLoading = false;
PatientModel patient = PatientModel( PatientModel patient = PatientModel(
ProjectID: 15, ProjectID: 15,
ClinicID: 0, ClinicID: 0,
DoctorID: 4709, DoctorID: 1485,
FirstName: "0", FirstName: "0",
MiddleName: "0", MiddleName: "0",
LastName: "0", LastName: "0",
@ -103,24 +107,28 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
), ),
):Container(), ):Container(),
Column( Column(
children: patientList.map((item) { children: patientList.map((item) {
return InkWell( return InkWell(
onTap: (){ onTap: (){
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": item, "patient": item,
}); });
}, },
child: CardWithBgWidget( child: AnimatedContainer(
widget: Container( duration: Duration(milliseconds: 200),
child: AppText( child: CardWithBgWidget(
'${item.firstName} ${item.lastName}', widget: Container(
fontSize: 2.5 * SizeConfig.textMultiplier, child: AppText(
'${item.firstName} ${item.lastName}',
fontSize: 2.5 * SizeConfig.textMultiplier,
),
),
), ),
), ),
), );
); }).toList()
}).toList() ),
)
], ],
), ),
), ),
@ -134,51 +142,59 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
/// When give qr we will change this method to get data /// When give qr we will change this method to get data
/// var result = await BarcodeScanner.scan(); /// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result /// int patientID = get from qr result
String patientType = "1"; var result = await BarcodeScanner.scan();
setState(() { // if (result.rawContent == "") {
isLoading = true; List<String> listOfParams = result.rawContent.split(',');
patientList = []; String patientType = "1";
}); setState(() {
patient.PatientID = 3120144; isLoading = true;
Provider.of<PatientsProvider>(context, listen: false) patientList = [];
.getPatientList(patient, "1") });
.then((response) { String token = await sharedPref.getString(TOKEN);
if (response['MessageStatus'] == 1) { patient.PatientID = 3120269;
switch (patientType) { patient.TokenID = token;
case "0": Provider.of<PatientsProvider>(context, listen: false)
if (response['List_MyOutPatient'] != null) { .getPatientList(patient, "1")
setState(() { .then((response) {
patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; if (response['MessageStatus'] == 1) {
isLoading = false; switch (patientType) {
}); case "0":
} else { if (response['List_MyOutPatient'] != null) {
setState(() { setState(() {
error = 'No patient'; patientList = ModelResponse
isLoading = false; .fromJson(response['List_MyOutPatient'])
}); .list;
} isLoading = false;
break; });
case "1": } else {
if (response['List_MyInPatient'] != null) { setState(() {
setState(() { error = 'No patient';
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; isLoading = false;
isLoading = false; });
error=""; }
});
} else {
setState(() {
error = 'No patient';
isLoading = false;
});
break; break;
} case "1":
if (response['List_MyInPatient'] != null) {
setState(() {
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
isLoading = false;
error = "";
});
} else {
setState(() {
error = 'No patient';
isLoading = false;
});
break;
}
}
} else {
setState(() {
error = response['ErrorMessage'] ?? response['ErrorEndUserMessage'];
isLoading = false;
});
} }
} else { });
setState(() { }
error = response['ErrorMessage'] ?? response['ErrorEndUserMessage']; // }
isLoading = false;
});
}
});
}
} }

@ -65,8 +65,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
_formKey.currentState.save(); _formKey.currentState.save();
//*********************************** */
sharedPref.setString(TOKEN, '@dm!n');
sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType);
print('_selectedType${_selectedType}'); print('_selectedType${_selectedType}');
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
@ -81,7 +80,6 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
"selectedType": _selectedType "selectedType": _selectedType
}); });
} else { } else {
// If all data are not valid then start auto validation.
setState(() { setState(() {
_autoValidate = true; _autoValidate = true;
}); });
@ -235,9 +233,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
_patientSearchFormValues.setLastName = "0"; _patientSearchFormValues.setLastName = "0";
} }
}, },
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS), inputFormatter: ONLY_LETTERS),
SizedBox( SizedBox(
height: 10, height: 10,
@ -286,7 +282,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'Patiant File', hintText: 'Patient File',
// validator: (value) { // validator: (value) {
// return TextValidator().validateIdNumber(value); // return TextValidator().validateIdNumber(value);
// }, // },

@ -37,15 +37,19 @@ class PatientsScreen extends StatefulWidget {
class _PatientsScreenState extends State<PatientsScreen> { class _PatientsScreenState extends State<PatientsScreen> {
List<dynamic> litems; List<dynamic> litems;
// final List parsed; // final List parsed;
List parsed; List parsed;
//********** //**********
List date; List date;
List unfilterDate; List unfilterDate;
//*********** //***********
List<PatiantInformtion> responseModelList; List<PatiantInformtion> responseModelList;
List<PatiantInformtion> responseModelList2; List<PatiantInformtion> responseModelList2;
// List<String> _locations = ['Today', 'Old Date', 'YESTERDAY']; // List<String> _locations = ['Today', 'Old Date', 'YESTERDAY'];
List<String> _locations = ['Today', 'Tomorrow', 'Next Week']; List<String> _locations = ['Today', 'Tomorrow', 'Next Week'];
int _activeLocation = 0; int _activeLocation = 0;
@ -53,11 +57,14 @@ class _PatientsScreenState extends State<PatientsScreen> {
bool _isInit = true; bool _isInit = true;
String patientType; String patientType;
String patientTypetitle; String patientTypetitle;
var _isLoading = true; var _isLoading = false;
bool _isError =true;
String error ="";
var _hasError;
//*******Amjad add to search box****** //*******Amjad add to search box******
final _controller = TextEditingController(); final _controller = TextEditingController();
//************** //**************
PatientModel patient; PatientModel patient;
PatientsProvider patientsProv; PatientsProvider patientsProv;
@ -77,26 +84,32 @@ class _PatientsScreenState extends State<PatientsScreen> {
if (_isInit) { if (_isInit) {
PatientsProvider patientsProv = Provider.of<PatientsProvider>(context); PatientsProvider patientsProv = Provider.of<PatientsProvider>(context);
setState(() {
_isLoading = true;
_isError = false;
error ="";
});
patientsProv.getPatientList(patient, patientType).then((res) { patientsProv.getPatientList(patient, patientType).then((res) {
setState(() { setState(() {
int val2 = int.parse(patientType);
litems = res[SERVICES_PATIANT2[val2]];
parsed = litems;
responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList2 = responseModelList;
//********************
_isLoading = false; _isLoading = false;
if (res['MessageStatus'] == 1) {
_hasError = res['ErrorEndUserMessage']; int val2 = int.parse(patientType);
litems = res[SERVICES_PATIANT2[val2]];
parsed = litems;
responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList2 = responseModelList;
_isError = false;
} else {
_isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}); });
print(res);
}).catchError((error) { }).catchError((error) {
// patientsProv.isLoading=false; setState(() {
// patientsProv.isError=true; _isError = true;
print("====================error================"); this.error = helpers.generateContactAdminMsg(error);
print(error); });
}); });
} }
@ -106,7 +119,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
} }
/* /*
*@author: Amjad Amireh *@author: Amjad Amireh
*@Date:2/5/2020 *@Date:2/5/2020
*@param: *@param:
*@return:PatientsScreen Search textbox filter *@return:PatientsScreen Search textbox filter
@ -141,7 +154,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
//***********DateFormat************** //***********DateFormat**************
/* /*
*@author: Amjad Amireh *@author: Amjad Amireh
*@Date:5/5/2020 *@Date:5/5/2020
*@param: *@param:
*@return:Convert time from Milesecond to date with time *@return:Convert time from Milesecond to date with time
@ -177,10 +190,10 @@ class _PatientsScreenState extends State<PatientsScreen> {
} }
/* /*
*@author: Amjad Amireh *@author: Amjad Amireh
*@Date:5/5/2020 *@Date:5/5/2020
*@param: *@param:
*@return:Convert time from Milesecond to date *@return:Convert time from Milesecond to date
*@desc: *@desc:
*/ */
@ -202,7 +215,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
return newDate.toString(); return newDate.toString();
} }
convertDateFormat2(String str) {
convertDateFormat2(String str) {
String timeConvert; String timeConvert;
const start = "/Date("; const start = "/Date(";
const end = "+0300)"; const end = "+0300)";
@ -220,6 +234,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
return newDate.toString(); return newDate.toString();
} }
filterBooking(String str) { filterBooking(String str) {
this.responseModelList = this.responseModelList2; this.responseModelList = this.responseModelList2;
@ -281,15 +296,13 @@ class _PatientsScreenState extends State<PatientsScreen> {
return AppScaffold( return AppScaffold(
appBarTitle: patientTypetitle, appBarTitle: patientTypetitle,
//***********Modify by amjad (create List view to insert all new data webservise in scroll )************* //***********Modify by amjad (create List view to insert all new data webservise in scroll )*************
body: patientsProv.isLoading body: _isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: patientsProv.isError : _isError
? DrAppEmbeddedError(error: patientsProv.error) ? DrAppEmbeddedError(error:error)
: litems == null : litems == null
? DrAppEmbeddedError( ? DrAppEmbeddedError(
error: 'You don\'t have any ' + error: 'You don\'t have any patient')
patientTypetitle +
" patiant")
: Container( : Container(
child: child:
ListView(scrollDirection: Axis.vertical, children: < ListView(scrollDirection: Axis.vertical, children: <
@ -332,7 +345,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
this.searchData(str); this.searchData(str);
}, },
decoration: buildInputDecoration( decoration: buildInputDecoration(
context, 'Search patiant'), context, 'Search Patient'),
), ),
), ),
Container( Container(
@ -367,11 +380,13 @@ class _PatientsScreenState extends State<PatientsScreen> {
patientType)] == patientType)] ==
"List_MyOutPatient" "List_MyOutPatient"
? AppText( ? AppText(
convertDateFormat2(item convertDateFormat2(item
.appointmentDate .appointmentDate
.toString())+" "+"-"+" "+item.startTime .toString()) +
, " " +
"-" +
" " +
item.startTime,
fontSize: 2.5 * fontSize: 2.5 *
SizeConfig SizeConfig
.textMultiplier) .textMultiplier)

@ -134,6 +134,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.3" version: "1.1.3"
charts_common:
dependency: transitive
description:
name: charts_common
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
charts_flutter:
dependency: "direct main"
description:
name: charts_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save