|
|
|
|
@ -1,19 +1,22 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_arrival/get_patient_arrival_list_request_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/routes.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/PatientCard.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:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -34,6 +37,9 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
List date;
|
|
|
|
|
List unFilterDate;
|
|
|
|
|
|
|
|
|
|
var clinicId;
|
|
|
|
|
AuthViewModel authProvider;
|
|
|
|
|
|
|
|
|
|
Color sideColor = Colors.black;
|
|
|
|
|
List<PatiantInformtion> responseModelList;
|
|
|
|
|
List<PatiantInformtion> responseModelList2;
|
|
|
|
|
@ -188,14 +194,26 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
authProvider = Provider.of(context);
|
|
|
|
|
_locations = [
|
|
|
|
|
TranslationBase.of(context).all,
|
|
|
|
|
TranslationBase.of(context).today,
|
|
|
|
|
TranslationBase.of(context).tomorrow,
|
|
|
|
|
TranslationBase.of(context).nextWeek,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.all,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.today,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.tomorrow,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.nextWeek,
|
|
|
|
|
];
|
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
final routeArgs = ModalRoute
|
|
|
|
|
.of(context)
|
|
|
|
|
.settings
|
|
|
|
|
.arguments as Map;
|
|
|
|
|
|
|
|
|
|
patient = routeArgs['patientSearchForm'];
|
|
|
|
|
|
|
|
|
|
@ -218,14 +236,12 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
|
|
|
|
|
model
|
|
|
|
|
.getPatientList(
|
|
|
|
|
val2 == 7
|
|
|
|
|
? getPatientArrivalListRequestModel.toJson()
|
|
|
|
|
: patient,
|
|
|
|
|
patientType)
|
|
|
|
|
val2 == 7
|
|
|
|
|
? getPatientArrivalListRequestModel.toJson()
|
|
|
|
|
: patient,
|
|
|
|
|
patientType)
|
|
|
|
|
.then((res) {
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (res != null && res['MessageStatus'] == 1) {
|
|
|
|
|
if (val2 == 7) {
|
|
|
|
|
if (res[SERVICES_PATIANT2[val2]] == null) {
|
|
|
|
|
@ -253,7 +269,6 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
responseModelList = new ModelResponse.fromJson(parsed).list;
|
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
|
_isError = false;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
_isError = true;
|
|
|
|
|
error = model.error??res['ErrorEndUserMessage'] ?? res['ErrorMessage'];
|
|
|
|
|
@ -275,114 +290,272 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
body: _isLoading
|
|
|
|
|
? Container()
|
|
|
|
|
: _isError
|
|
|
|
|
? DrAppEmbeddedError(error: error)
|
|
|
|
|
: lItems == null || lItems.length == 0
|
|
|
|
|
? DrAppEmbeddedError(
|
|
|
|
|
error:
|
|
|
|
|
TranslationBase.of(context).youDontHaveAnyPatient)
|
|
|
|
|
: Container(
|
|
|
|
|
child: ListView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: lItems == null
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(
|
|
|
|
|
0, 0, 0, 0), //250
|
|
|
|
|
child:
|
|
|
|
|
DrAppCircularProgressIndeicator(),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.03),
|
|
|
|
|
child: SERVICES_PATIANT2[
|
|
|
|
|
int.parse(patientType)] ==
|
|
|
|
|
"List_MyOutPatient"
|
|
|
|
|
? _locationBar(context)
|
|
|
|
|
: Container(),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 18.5),
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
|
height:
|
|
|
|
|
SizeConfig.screenHeight * 0.05,
|
|
|
|
|
child: TextField(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
onChanged: (String str) {
|
|
|
|
|
this.searchData(str);
|
|
|
|
|
},
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.searchPatient),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
thickness: 0.8,
|
|
|
|
|
color: Color(0xffCCCCCC),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0Xffffffff),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(20)),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
child: (responseModelList.length > 0)
|
|
|
|
|
? Column(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: responseModelList
|
|
|
|
|
.map((PatiantInformtion
|
|
|
|
|
item) {
|
|
|
|
|
return PatientCard(patientInfo: item,
|
|
|
|
|
patientType: patientType,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(
|
|
|
|
|
PATIENTS_PROFILE,
|
|
|
|
|
arguments: {
|
|
|
|
|
"patient": item,
|
|
|
|
|
"patientType":patientType,
|
|
|
|
|
"from" : patient.getFrom,
|
|
|
|
|
"to" : patient.getTo,
|
|
|
|
|
});
|
|
|
|
|
},);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: DrAppEmbeddedError(
|
|
|
|
|
error: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
|
),
|
|
|
|
|
? DrAppEmbeddedError(error: error)
|
|
|
|
|
: lItems == null || lItems.length == 0
|
|
|
|
|
? DrAppEmbeddedError(
|
|
|
|
|
error:
|
|
|
|
|
TranslationBase.of(context).youDontHaveAnyPatient)
|
|
|
|
|
: Container(
|
|
|
|
|
child: ListView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: lItems == null
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(
|
|
|
|
|
0, 0, 0, 0), //250
|
|
|
|
|
child:
|
|
|
|
|
DrAppCircularProgressIndeicator(),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.03),
|
|
|
|
|
child: SERVICES_PATIANT2[
|
|
|
|
|
int.parse(patientType)] ==
|
|
|
|
|
"List_MyOutPatient"
|
|
|
|
|
? _locationBar(context)
|
|
|
|
|
: Container(),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 18.5),
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
|
height:
|
|
|
|
|
SizeConfig.screenHeight * 0.05,
|
|
|
|
|
child: TextField(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
onChanged: (String str) {
|
|
|
|
|
this.searchData(str);
|
|
|
|
|
},
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.searchPatient),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
if(int.parse(patientType)==7)
|
|
|
|
|
projectsProvider
|
|
|
|
|
.doctorClinicsList.length >
|
|
|
|
|
0
|
|
|
|
|
? FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width *0.8,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
dropdownColor:
|
|
|
|
|
Colors.white,
|
|
|
|
|
iconEnabledColor:
|
|
|
|
|
Colors.black,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: clinicId == null
|
|
|
|
|
? projectsProvider
|
|
|
|
|
.doctorClinicsList[
|
|
|
|
|
0]
|
|
|
|
|
.clinicID
|
|
|
|
|
: clinicId,
|
|
|
|
|
iconSize: 25,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext
|
|
|
|
|
context) {
|
|
|
|
|
return projectsProvider
|
|
|
|
|
.doctorClinicsList
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize:
|
|
|
|
|
MainAxisSize
|
|
|
|
|
.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
item.clinicName,
|
|
|
|
|
fontSize: SizeConfig
|
|
|
|
|
.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
color: Colors
|
|
|
|
|
.black,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) {
|
|
|
|
|
clinicId = newValue;
|
|
|
|
|
changeClinic(newValue, context, model);
|
|
|
|
|
},
|
|
|
|
|
items: projectsProvider
|
|
|
|
|
.doctorClinicsList
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
item.clinicName,
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
value: item.clinicID,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: AppText(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.noClinic),
|
|
|
|
|
Divider(
|
|
|
|
|
thickness: 0.8,
|
|
|
|
|
color: Color(0xffCCCCCC),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0Xffffffff),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(20)),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
child: (responseModelList.length > 0)
|
|
|
|
|
? Column(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: responseModelList
|
|
|
|
|
.map((PatiantInformtion
|
|
|
|
|
item) {
|
|
|
|
|
return PatientCard(patientInfo: item,
|
|
|
|
|
patientType: patientType,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(
|
|
|
|
|
PATIENTS_PROFILE,
|
|
|
|
|
arguments: {
|
|
|
|
|
"patient": item,
|
|
|
|
|
"patientType":patientType,
|
|
|
|
|
"from" : patient.getFrom,
|
|
|
|
|
"to" : patient.getTo,
|
|
|
|
|
});
|
|
|
|
|
},);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: DrAppEmbeddedError(
|
|
|
|
|
error: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeClinic(clinicId, BuildContext context, model) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
|
|
|
|
|
ProfileReqModel docInfo = new ProfileReqModel(
|
|
|
|
|
doctorID: doctorProfile.doctorID,
|
|
|
|
|
clinicID: clinicId,
|
|
|
|
|
license: true,
|
|
|
|
|
projectID: doctorProfile.projectID,
|
|
|
|
|
tokenID: '',
|
|
|
|
|
languageID: 2);
|
|
|
|
|
|
|
|
|
|
authProvider.getDocProfiles(docInfo.toJson(), allowChangeProfile: false)
|
|
|
|
|
.then((profileList) async {
|
|
|
|
|
print(profileList['DoctorProfileList'][0]);
|
|
|
|
|
int val2 = int.parse(patientType);
|
|
|
|
|
|
|
|
|
|
GetPatientArrivalListRequestModel
|
|
|
|
|
|
|
|
|
|
getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel(
|
|
|
|
|
from: patient.From,
|
|
|
|
|
to: patient.To,
|
|
|
|
|
clinicID: profileList['DoctorProfileList'][0]['ClinicID'],
|
|
|
|
|
doctorID: profileList['DoctorProfileList'][0]['DoctorID'].toString(),
|
|
|
|
|
patientMRN: patient.getPatientID,
|
|
|
|
|
pageIndex: 0,
|
|
|
|
|
pageSize: 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model
|
|
|
|
|
.getPatientList(
|
|
|
|
|
getPatientArrivalListRequestModel.toJson(),
|
|
|
|
|
patientType)
|
|
|
|
|
.then((res) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res != null && res['MessageStatus'] == 1) {
|
|
|
|
|
if (val2 == 7) {
|
|
|
|
|
if (res[SERVICES_PATIANT2[val2]] == null) {
|
|
|
|
|
_isError = true;
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
this.error = error.toString();
|
|
|
|
|
} else {
|
|
|
|
|
var localList = [];
|
|
|
|
|
if (res["patientArrivalList"]["entityList"] == null) {
|
|
|
|
|
res["patientArrivalList"]["entityList"] = [];
|
|
|
|
|
}
|
|
|
|
|
res["patientArrivalList"]["entityList"].forEach((v) {
|
|
|
|
|
Map<String, dynamic> mergedPatient = {
|
|
|
|
|
...v,
|
|
|
|
|
...v["patientDetails"]
|
|
|
|
|
};
|
|
|
|
|
localList.add(mergedPatient);
|
|
|
|
|
});
|
|
|
|
|
lItems = localList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
parsed = lItems;
|
|
|
|
|
responseModelList = new ModelResponse.fromJson(parsed).list;
|
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
|
_isError = false;
|
|
|
|
|
} else {
|
|
|
|
|
_isError = true;
|
|
|
|
|
error = model.error ?? res['ErrorEndUserMessage'] ??
|
|
|
|
|
res['ErrorMessage'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
}).catchError((error) {
|
|
|
|
|
helpers.showErrorToast(error.toString());
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
helpers.showErrorToast(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputDecoration buildInputDecoration(BuildContext context, hint) {
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
prefixIcon: Icon(Icons.search, color: Colors.grey),
|
|
|
|
|
|