|
|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/filter_type.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/patient_type.dart';
|
|
|
|
|
import 'file:///C:/Users/admin/AndroidStudioProjects/doctor_app_flutter/lib/core/model/patient_muse/PatientSearchRequestModel.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
|
@ -42,18 +43,19 @@ class OutPatientsScreen extends StatefulWidget {
|
|
|
|
|
final bool isSearchAndOut;
|
|
|
|
|
final String searchKey;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OutPatientsScreen(
|
|
|
|
|
{this.patientSearchForm,
|
|
|
|
|
this.selectedType,
|
|
|
|
|
this.isAppbar = true,
|
|
|
|
|
this.arrivalType,
|
|
|
|
|
this.isView,
|
|
|
|
|
this.selectedPatientType,
|
|
|
|
|
this.patientSearchRequestModel,
|
|
|
|
|
this.isSearchWithKeyInfo = true,
|
|
|
|
|
this.isSearch = false,
|
|
|
|
|
this.isInpatient = false, this.searchKey, this.isSearchAndOut=false});
|
|
|
|
|
this.selectedType,
|
|
|
|
|
this.isAppbar = true,
|
|
|
|
|
this.arrivalType,
|
|
|
|
|
this.isView,
|
|
|
|
|
this.selectedPatientType,
|
|
|
|
|
this.patientSearchRequestModel,
|
|
|
|
|
this.isSearchWithKeyInfo = true,
|
|
|
|
|
this.isSearch = false,
|
|
|
|
|
this.isInpatient = false,
|
|
|
|
|
this.searchKey,
|
|
|
|
|
this.isSearchAndOut = false});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OutPatientsScreenState createState() => _OutPatientsScreenState();
|
|
|
|
|
@ -82,20 +84,11 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
authProvider = Provider.of(context);
|
|
|
|
|
_times = [
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.previous,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.today,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.nextWeek,
|
|
|
|
|
TranslationBase.of(context).previous,
|
|
|
|
|
TranslationBase.of(context).today,
|
|
|
|
|
TranslationBase.of(context).nextWeek,
|
|
|
|
|
];
|
|
|
|
|
final screenSize = MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size;
|
|
|
|
|
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientSearchViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
@ -106,148 +99,155 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: PatientSearchHeader(
|
|
|
|
|
title: "My Out patient",
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration: TextFieldsUtils
|
|
|
|
|
.containerBorderDecoration(
|
|
|
|
|
Color(0Xffffffff),
|
|
|
|
|
Color(0xFFCCCCCC),
|
|
|
|
|
borderRadius: 4,
|
|
|
|
|
borderWidth: 0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: _times.map((item) {
|
|
|
|
|
bool _isActive = _times[_activeLocation] == item
|
|
|
|
|
? true
|
|
|
|
|
: false;
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration: TextFieldsUtils.containerBorderDecoration(
|
|
|
|
|
Color(0Xffffffff), Color(0xFFCCCCCC),
|
|
|
|
|
borderRadius: 4, borderWidth: 0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: _times.map((item) {
|
|
|
|
|
bool _isActive =
|
|
|
|
|
_times[_activeLocation] == item ? true : false;
|
|
|
|
|
|
|
|
|
|
return Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
setState(() {
|
|
|
|
|
_activeLocation = _times.indexOf(item);
|
|
|
|
|
outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==1?OutPatientFilterType.Today:OutPatientFilterType.NextWeek;
|
|
|
|
|
_controller.text="";
|
|
|
|
|
});
|
|
|
|
|
model.searchData("");
|
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getPatientBasedOnDate(item: item,
|
|
|
|
|
selectedPatientType: widget.selectedPatientType,
|
|
|
|
|
patientSearchRequestModel: widget
|
|
|
|
|
.patientSearchRequestModel,
|
|
|
|
|
isSearchWithKeyInfo: widget.isSearchWithKeyInfo, outPatientFilterType: outPatientFilterType);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
},
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration: TextFieldsUtils.containerBorderDecoration(
|
|
|
|
|
_isActive
|
|
|
|
|
? Color(0xFFD02127 /*B8382B*/)
|
|
|
|
|
: Color(0xFFEAEAEA),
|
|
|
|
|
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
|
|
|
|
borderRadius: 4,
|
|
|
|
|
borderWidth: 0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
item,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
color: _isActive ? Colors.white : Color(0xFF2B353E),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
|
_isActive&&_activeLocation!=0&&model.state == ViewState.Idle ?Container(
|
|
|
|
|
padding: EdgeInsets.all(2),
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 5),
|
|
|
|
|
decoration:
|
|
|
|
|
new BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(
|
|
|
|
|
50),
|
|
|
|
|
),
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
minWidth: 20,
|
|
|
|
|
minHeight: 20,
|
|
|
|
|
),
|
|
|
|
|
child: new Text(
|
|
|
|
|
model.filterData.length.toString(),
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontSize: 10
|
|
|
|
|
),
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
):Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
return Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
setState(() {
|
|
|
|
|
_activeLocation = _times.indexOf(item);
|
|
|
|
|
outPatientFilterType = _activeLocation == 0
|
|
|
|
|
? OutPatientFilterType.Previous
|
|
|
|
|
: _activeLocation == 1
|
|
|
|
|
? OutPatientFilterType.Today
|
|
|
|
|
: OutPatientFilterType.NextWeek;
|
|
|
|
|
_controller.text = "";
|
|
|
|
|
});
|
|
|
|
|
model.searchData("");
|
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getPatientBasedOnDate(
|
|
|
|
|
item: item,
|
|
|
|
|
selectedPatientType: widget.selectedPatientType,
|
|
|
|
|
patientSearchRequestModel:
|
|
|
|
|
widget.patientSearchRequestModel,
|
|
|
|
|
isSearchWithKeyInfo: widget.isSearchWithKeyInfo,
|
|
|
|
|
outPatientFilterType: outPatientFilterType);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
},
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration:
|
|
|
|
|
TextFieldsUtils.containerBorderDecoration(
|
|
|
|
|
_isActive
|
|
|
|
|
? Color(0xFFD02127 /*B8382B*/)
|
|
|
|
|
: Color(0xFFEAEAEA),
|
|
|
|
|
_isActive
|
|
|
|
|
? Color(0xFFD02127)
|
|
|
|
|
: Color(0xFFEAEAEA),
|
|
|
|
|
borderRadius: 4,
|
|
|
|
|
borderWidth: 0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
item,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
color: _isActive
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Color(0xFF2B353E),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
|
_isActive &&
|
|
|
|
|
_activeLocation != 0 &&
|
|
|
|
|
model.state == ViewState.Idle
|
|
|
|
|
? Container(
|
|
|
|
|
padding: EdgeInsets.all(2),
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 5),
|
|
|
|
|
decoration: new BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(50),
|
|
|
|
|
),
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
minWidth: 20,
|
|
|
|
|
minHeight: 20,
|
|
|
|
|
),
|
|
|
|
|
child: new Text(
|
|
|
|
|
model.filterData.length.toString(),
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontSize: 10),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 18.5),
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
|
height: 75,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 10, top: 10),
|
|
|
|
|
padding: EdgeInsets.only(left: 10, top: 10),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.searchPatientName,
|
|
|
|
|
TranslationBase.of(context).searchPatientName,
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
)),
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
// focusNode: focusProject,
|
|
|
|
|
// focusNode: focusProject,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
borderColor: Colors.white
|
|
|
|
|
,
|
|
|
|
|
borderColor: Colors.white,
|
|
|
|
|
prefix: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
_activeLocation !=0
|
|
|
|
|
_activeLocation != 0
|
|
|
|
|
? DoctorApp.filter_1
|
|
|
|
|
: FontAwesomeIcons.slidersH,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
iconSize: 20,
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(
|
|
|
|
|
bottom: 30),
|
|
|
|
|
onPressed: _activeLocation !=0 ? null : () {
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
FilterDatePage(outPatientFilterType: outPatientFilterType,patientSearchViewModel: model,)));
|
|
|
|
|
},
|
|
|
|
|
padding: EdgeInsets.only(bottom: 30),
|
|
|
|
|
onPressed: _activeLocation != 0
|
|
|
|
|
? null
|
|
|
|
|
: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
FilterDatePage(
|
|
|
|
|
outPatientFilterType:
|
|
|
|
|
outPatientFilterType,
|
|
|
|
|
patientSearchViewModel:
|
|
|
|
|
model,
|
|
|
|
|
)));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
onChanged: (String str) {
|
|
|
|
|
model.searchData(str);
|
|
|
|
|
}),
|
|
|
|
|
@ -255,58 +255,60 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: model.filterData.isEmpty
|
|
|
|
|
? Center(
|
|
|
|
|
child: ErrorMessage(
|
|
|
|
|
error: TranslationBase.of(context)
|
|
|
|
|
.youDontHaveAnyPatient,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.filterData.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
if(_activeLocation !=0 || (model.filterData[index].patientStatusType !=null && model.filterData[index].patientStatusType==43))
|
|
|
|
|
return
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: PatientCard(
|
|
|
|
|
patientInfo: model.filterData[index],
|
|
|
|
|
patientType: patientType,
|
|
|
|
|
arrivalType: arrivalType,
|
|
|
|
|
isFromSearch:widget.isSearchAndOut,
|
|
|
|
|
isInpatient: widget.isInpatient,
|
|
|
|
|
onTap: () {
|
|
|
|
|
// TODO change the parameter to daynamic
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
PATIENTS_PROFILE,
|
|
|
|
|
arguments: {
|
|
|
|
|
"patient": model.filterData[index],
|
|
|
|
|
"patientType": "1",
|
|
|
|
|
"from": widget
|
|
|
|
|
.patientSearchRequestModel.from,
|
|
|
|
|
"to": widget
|
|
|
|
|
.patientSearchRequestModel.from,
|
|
|
|
|
"isSearch": false,
|
|
|
|
|
"isInpatient": false,
|
|
|
|
|
"arrivalType": "7",
|
|
|
|
|
"isSearchAndOut": false,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// isFromSearch: widget.isSearch,
|
|
|
|
|
child: ErrorMessage(
|
|
|
|
|
error: TranslationBase.of(context)
|
|
|
|
|
.youDontHaveAnyPatient,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
return SizedBox();
|
|
|
|
|
})),
|
|
|
|
|
)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.filterData.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
if (_activeLocation != 0 ||
|
|
|
|
|
(model.filterData[index].patientStatusType !=
|
|
|
|
|
null &&
|
|
|
|
|
model.filterData[index]
|
|
|
|
|
.patientStatusType ==
|
|
|
|
|
43))
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: PatientCard(
|
|
|
|
|
patientInfo: model.filterData[index],
|
|
|
|
|
patientType: patientType,
|
|
|
|
|
arrivalType: arrivalType,
|
|
|
|
|
isFromSearch: widget.isSearchAndOut,
|
|
|
|
|
isInpatient: widget.isInpatient,
|
|
|
|
|
onTap: () {
|
|
|
|
|
// TODO change the parameter to daynamic
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
PATIENTS_PROFILE,
|
|
|
|
|
arguments: {
|
|
|
|
|
"patient": model.filterData[index],
|
|
|
|
|
"patientType": "1",
|
|
|
|
|
"from": widget
|
|
|
|
|
.patientSearchRequestModel.from,
|
|
|
|
|
"to": widget
|
|
|
|
|
.patientSearchRequestModel.from,
|
|
|
|
|
"isSearch": false,
|
|
|
|
|
"isInpatient": false,
|
|
|
|
|
"arrivalType": "7",
|
|
|
|
|
"isSearchAndOut": false,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// isFromSearch: widget.isSearch,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
return SizedBox();
|
|
|
|
|
})),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|