working on in-patient screen design

merge-requests/627/head
mosazaid 4 years ago
parent ee4d7b785b
commit b43b7cafcc

@ -336,7 +336,7 @@ const TRANSACTION_NO = 0;
const LANGUAGE_ID = 2;
const STAMP = '2020-04-27T12:17:17.721Z';
const IP_ADDRESS = '9.9.9.9';
const VERSION_ID = 5.8;
const VERSION_ID = 6.0;
const CHANNEL = 9;
const SESSION_ID = 'BlUSkYymTt';
const IS_LOGIN_FOR_DOCTOR_APP = true;

@ -946,4 +946,5 @@ const Map<String, Map<String, String>> localizedValues = {
"approvals22": {"en": "Approvals", "ar": "التامين"},
"severe": {"en": "Severe", "ar": "الشدة"},
"graphDetails": {"en": "Graph Details", "ar": "تفاصيل الرسم البياني"},
"discharged": {"en": "Discharged", "ar": "المصرف"},
};

@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class PatientInPatientService extends BaseService {
List<PatiantInformtion> inPatientList = List();
List<PatiantInformtion> myInPatientList = List();
Future getInPatientList(
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
@ -21,9 +22,14 @@ class PatientInPatientService extends BaseService {
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {
inPatientList.clear();
myInPatientList.clear();
response['List_MyInPatient'].forEach((v) {
inPatientList.add(PatiantInformtion.fromJson(v));
PatiantInformtion patient = PatiantInformtion.fromJson(v);
inPatientList.add(patient);
if(patient.doctorId == doctorProfile.doctorID){
myInPatientList.add(patient);
}
});
},
onFailure: (String error, int statusCode) {

@ -24,10 +24,14 @@ class PatientSearchViewModel extends BaseViewModel{
if (strExist) {
filterData = [];
for (var i = 0; i < _outPatientService.patientList.length; i++) {
String firstName = _outPatientService.patientList[i].firstName.toUpperCase();
String lastName = _outPatientService.patientList[i].lastName.toUpperCase();
String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase();
String patientID = _outPatientService.patientList[i].patientId.toString();
String firstName =
_outPatientService.patientList[i].firstName.toUpperCase();
String lastName =
_outPatientService.patientList[i].lastName.toUpperCase();
String mobile =
_outPatientService.patientList[i].mobileNumber.toUpperCase();
String patientID =
_outPatientService.patientList[i].patientId.toString();
if (firstName.contains(str.toUpperCase()) ||
lastName.contains(str.toUpperCase()) ||
@ -43,7 +47,8 @@ class PatientSearchViewModel extends BaseViewModel{
}
}
getOutPatient(PatientSearchRequestModel patientSearchRequestModel , {bool isLocalBusy = false}) async {
getOutPatient(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
@ -51,8 +56,7 @@ class PatientSearchViewModel extends BaseViewModel{
}
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
await _outPatientService.getOutPatient(
patientSearchRequestModel);
await _outPatientService.getOutPatient(patientSearchRequestModel);
if (_outPatientService.hasError) {
error = _outPatientService.error;
if (isLocalBusy) {
@ -66,10 +70,11 @@ class PatientSearchViewModel extends BaseViewModel{
}
}
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async {
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
setState(ViewState.Busy);
await _outPatientService.getPatientFileInformation(
patientSearchRequestModel);
await _outPatientService
.getPatientFileInformation(patientSearchRequestModel);
if (_outPatientService.hasError) {
error = _outPatientService.error;
setState(ViewState.Error);
@ -79,30 +84,21 @@ class PatientSearchViewModel extends BaseViewModel{
}
}
getPatientBasedOnDate(
{item, PatientSearchRequestModel patientSearchRequestModel, PatientType selectedPatientType,
{item,
PatientSearchRequestModel patientSearchRequestModel,
PatientType selectedPatientType,
bool isSearchWithKeyInfo}) async {
String dateTo;
String dateFrom;
if (item == 'Previous') {
selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month-1,
DateTime.now().day);
selectedToDate = DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day-1);
dateTo = DateUtils.convertDateToFormat(
selectedToDate,
'yyyy-MM-dd');
dateFrom = DateUtils.convertDateToFormat(
selectedFromDate,
'yyyy-MM-dd');
selectedFromDate = DateTime(
DateTime.now().year, DateTime.now().month - 1, DateTime.now().day);
selectedToDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
dateTo = DateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd');
dateFrom = DateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd');
} else if (item == 'Next Week') {
dateTo = DateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day + 6),
@ -132,61 +128,63 @@ class PatientSearchViewModel extends BaseViewModel{
currentModel.to = dateTo;
await getOutPatient(currentModel, isLocalBusy: true);
filterData = _outPatientService.patientList;
}
PatientInPatientService _inPatientService =
locator<PatientInPatientService>();
List<PatiantInformtion> get _inPatientList => _inPatientService.inPatientList;
List<PatiantInformtion> get inPatientList => _inPatientService.inPatientList;
List<PatiantInformtion> get myIinPatientList =>
_inPatientService.myInPatientList;
List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false, bool isFirstTime = true}) async {
{bool isMyInpatient = false}) async {
await getDoctorProfile();
if (isFirstTime)
setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
if (inPatientList.length == 0)
await _inPatientService.getInPatientList(requestModel, false);
if (_inPatientService.hasError) {
error = _inPatientService.error;
setState(ViewState.Error);
} else {
filteredInPatientItems.clear();
if (_inPatientList.length > 0)
filteredInPatientItems.addAll(_inPatientList);
if (inPatientList.length > 0)
filteredInPatientItems.addAll(inPatientList);
setState(ViewState.Idle);
}
}
void clearPatientList(){
_inPatientService.inPatientList = [];
_inPatientService.myInPatientList = [];
}
void filterSearchResults(String query) {
var strExist = query.length > 0 ? true : false;
if (strExist) {
filteredInPatientItems = [];
for (var i = 0; i < _inPatientList.length; i++) {
String firstName = _inPatientList[i].firstName.toUpperCase();
String lastName = _inPatientList[i].lastName.toUpperCase();
String mobile = _inPatientList[i].mobileNumber.toUpperCase();
String patientID = _inPatientList[i].patientId.toString();
for (var i = 0; i < inPatientList.length; i++) {
String firstName = inPatientList[i].firstName.toUpperCase();
String lastName = inPatientList[i].lastName.toUpperCase();
String mobile = inPatientList[i].mobileNumber.toUpperCase();
String patientID = inPatientList[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||
lastName.contains(query.toUpperCase()) ||
mobile.contains(query) ||
patientID.contains(query)) {
filteredInPatientItems.add(_inPatientList[i]);
filteredInPatientItems.add(inPatientList[i]);
}
}
notifyListeners();
} else {
if (_inPatientList.length > 0)
filteredInPatientItems.clear();
filteredInPatientItems.addAll(_inPatientList);
if (inPatientList.length > 0) filteredInPatientItems.clear();
filteredInPatientItems.addAll(inPatientList);
notifyListeners();
}
}
}

@ -29,12 +29,15 @@ class _DischargedPatientState extends State<DischargedPatient> {
appBarTitle: 'Discharged Patient',
subtitle: "Last Three Months",
backgroundColor: Colors.grey[200],
isShowAppBar: true,
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargedPatient.isEmpty? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 100,
),
@ -53,6 +56,9 @@ class _DischargedPatientState extends State<DischargedPatient> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(height: 12,),
Container(
width: double.maxFinite,

@ -0,0 +1,164 @@
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import '../../routes.dart';
class InPatientPage extends StatefulWidget {
final bool isMyInPatient;
InPatientPage(this.isMyInPatient);
@override
_InPatientPageState createState() => _InPatientPageState();
}
class _InPatientPageState extends State<InPatientPage> {
TextEditingController _searchController = TextEditingController();
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
@override
void dispose() {
_searchController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BaseView<PatientSearchViewModel>(
onModelReady: (model) => model.getInPatientList(requestModel),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
Container(
margin: EdgeInsets.all(16.0),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
model.filterSearchResults(value);
}),
),
model.filteredInPatientItems.length > 0
? Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(
model.filteredInPatientItems.length, (index) {
if (!widget.isMyInPatient)
return PatientCard(
patientInfo:
model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model
.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model
.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else if (model.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID &&
widget.isMyInPatient)
return PatientCard(
patientInfo:
model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model
.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model
.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else
return SizedBox();
}),
SizedBox(
height: 15,
)
],
),
),
),
)
: Expanded(
child: SingleChildScrollView(
child: Container(
child: ErrorMessage(
error:
TranslationBase.of(context).noDataAvailable)),
),
),
],
),
),
);
}
}

@ -15,22 +15,36 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.
import 'package:flutter/material.dart';
import '../../routes.dart';
import 'DischargedPatientPage.dart';
import 'InPatientPage.dart';
class PatientInPatientScreen extends StatefulWidget {
@override
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
}
class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
class _PatientInPatientScreenState extends State<PatientInPatientScreen> with SingleTickerProviderStateMixin{
TabController _tabController;
int _activeTab = 0;
TextEditingController _searchController = TextEditingController();
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this);
_tabController.addListener(_handleTabSelection);
}
@override
void dispose() {
_searchController.dispose();
super.dispose();
_tabController.dispose();
}
_handleTabSelection() {
setState(() {
_activeTab = _tabController.index;
});
}
@override
@ -38,7 +52,7 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
final screenSize = MediaQuery.of(context).size;
return BaseView<PatientSearchViewModel>(
onModelReady: (model) => model.getInPatientList(requestModel),
onModelReady: (model) => model.clearPatientList(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
@ -71,100 +85,54 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
]),
),
),
tabsBar(context, screenSize, model),
Container(
margin: EdgeInsets.all(16.0),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context)
.searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
model.filterSearchResults(value);
}),
),
model.filteredInPatientItems.length > 0
? Expanded(
Expanded(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
height: MediaQuery.of(context).size.height * 0.070,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.5), //width: 0.7
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorColor: Colors.transparent,
indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(top: 0, left:0, right: 0,bottom: 0),
unselectedLabelColor: Colors.grey[800],
tabs: [
tabWidget(screenSize, _activeTab == 0, TranslationBase.of(context).inPatientAll.toUpperCase(), counter: model.inPatientList.length),
tabWidget(screenSize, _activeTab == 1, TranslationBase.of(context).inPatient.toUpperCase(), counter: model.myIinPatientList.length),
tabWidget(screenSize, _activeTab == 2, TranslationBase.of(context).discharged.toUpperCase()),
],
),
),
),
),
body: Column(
children: [
// const SizedBox(
// height: 16,
// ),
...List.generate(model.filteredInPatientItems.length, (index) {
if(_activeTab == 0)
return PatientCard(
patientInfo: model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else if(model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID && _activeTab==1)
return PatientCard(
patientInfo: model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else return SizedBox();
}),
SizedBox(height: 15,)
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
InPatientPage(false),
InPatientPage(true),
DischargedPatient(),
],
),
),
],
),
)
: Expanded(
child: SingleChildScrollView(
child: Container(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable)),
),
),
],
@ -173,66 +141,51 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
);
}
Widget tabsBar(
BuildContext context, Size screenSize, PatientSearchViewModel model) {
List<String> _tabs = [
TranslationBase.of(context).inPatientAll.toUpperCase(),
TranslationBase.of(context).inPatient.toUpperCase(),
];
Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1}){
return Container(
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: _tabs.map((item) {
bool _isActive = _tabs[_activeTab] == item ? true : false;
return Expanded(
child: InkWell(
onTap: () async {
setState(() {
_activeTab = _tabs.indexOf(item);
});
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (_activeTab==0) {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getInPatientList(requestModel,
isMyInpatient: _activeTab == 1, isFirstTime: false);
GifLoaderDialogUtils.hideDialog(
context);
}
},
child: Center(
return Center(
child: Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
_isActive
isActive
? Color(0xFFD02127 /*B8382B*/)
: Color(0xFFEAEAEA),
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.8,
color: isActive ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
if (counter != -1)
Container(
margin: EdgeInsets.all(4),
width: 15,
height: 15,
decoration: BoxDecoration(
color: isActive
? Colors.white
: Color(0xFFD02127),
shape: BoxShape.circle,
),
child: Center(
child: FittedBox(
child: AppText(
item,
fontSize: SizeConfig.textMultiplier * 1.8,
color: _isActive ? Colors.white : Color(0xFF2B353E),
"$counter",
fontSize: SizeConfig.textMultiplier * 1.5,
color: !isActive ? Colors.white : Color(0xFFD02127),
fontWeight: FontWeight.w700,
),
),
),
),
],
),
);
}).toList(),
),
);
}

@ -39,7 +39,7 @@ class ProfileGridForInPatient extends StatelessWidget {
NeverScrollableScrollPhysics(),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 1 / 1.0,
childAspectRatio: 1 / 1.02,
crossAxisCount: 3,
children: [
PatientProfileButton(

@ -1301,8 +1301,8 @@ class TranslationBase {
String get insurance22 => localizedValues["insurance22"][locale.languageCode];
String get approvals22 => localizedValues["approvals22"][locale.languageCode];
String get severe => localizedValues["severe"][locale.languageCode];
String get graphDetails =>
localizedValues["graphDetails"][locale.languageCode];
String get graphDetails => localizedValues["graphDetails"][locale.languageCode];
String get discharged => localizedValues["discharged"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -47,8 +47,8 @@ class PatientProfileButton extends StatelessWidget {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
return new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
padding: EdgeInsets.fromLTRB(10, 10, 10, 5),
margin: EdgeInsets.symmetric(horizontal: 0.0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: InkWell(
onTap: isDisable
? null
@ -72,7 +72,7 @@ class PatientProfileButton extends StatelessWidget {
)),
Container(
alignment: projectsProvider.isArabic ? Alignment.topRight : Alignment.topLeft,
padding: EdgeInsets.all(5),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

@ -566,7 +566,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.1"
version: "0.6.2"
json_annotation:
dependency: transitive
description:
@ -608,7 +608,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.4"
version: "1.3.0-nullsafety.3"
mime:
dependency: transitive
description:
@ -900,7 +900,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.2"
version: "1.10.0-nullsafety.1"
sticky_headers:
dependency: "direct main"
description:
@ -1091,5 +1091,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.10.0 <=2.11.0-213.1.beta"
dart: ">=2.10.0 <2.11.0"
flutter: ">=1.22.0 <2.0.0"

Loading…
Cancel
Save