Merge branch 'referral_in_patient' into 'development'

fix in filter page

See merge request Cloud_Solution/doctor_app_flutter!623
in-patient_re-design
Mohammad Aljammal 5 years ago
commit ee4d7b785b

@ -71,7 +71,7 @@ class BaseAppClient {
(body['ProjectID'] == 2 || body['ProjectID'] == 3)) { (body['ProjectID'] == 2 || body['ProjectID'] == 3)) {
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
} }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
var asd = json.encode(body); var asd = json.encode(body);

@ -49,7 +49,8 @@ class PatientSearchViewModel extends BaseViewModel{
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
await _outPatientService.getOutPatient( await _outPatientService.getOutPatient(
patientSearchRequestModel); patientSearchRequestModel);
if (_outPatientService.hasError) { if (_outPatientService.hasError) {

@ -22,7 +22,17 @@ class BaseViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<DoctorProfileModel> getDoctorProfile() async { Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async {
if(isGetProfile)
{
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile != null) {
return doctorProfile;
}
}
}
if (doctorProfile == null) { if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) { if (profile != null) {

@ -240,6 +240,11 @@ class _FilterDatePageState extends State<FilterDatePage> {
if (isFromDate) { if (isFromDate) {
setState(() { setState(() {
this.widget.patientSearchViewModel.selectedFromDate = picked; this.widget.patientSearchViewModel.selectedFromDate = picked;
var date = picked.add(Duration(days: 30));
if(date.isBefore(lastDate)){
this.widget.patientSearchViewModel.selectedToDate = date;
}else
this.widget.patientSearchViewModel.selectedToDate = lastDate;
}); });
} else { } else {
setState(() { setState(() {

@ -132,7 +132,10 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
setState(() { setState(() {
_activeLocation = _times.indexOf(item); _activeLocation = _times.indexOf(item);
outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek; outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek;
_controller.text="";
}); });
model.searchData("");
FocusScope.of(context).requestFocus(new FocusNode());
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getPatientBasedOnDate(item: item, await model.getPatientBasedOnDate(item: item,
selectedPatientType: widget.selectedPatientType, selectedPatientType: widget.selectedPatientType,
@ -222,6 +225,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Expanded( Expanded(
child: Container( child: Container(
child: model.filterData.isEmpty child: model.filterData.isEmpty
@ -236,7 +240,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return Padding( if(_activeLocation !=0 || (model.filterData[index].patientStatusType !=null && model.filterData[index].patientStatusType==43))
return
Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
@ -264,6 +270,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),
); );
else
return SizedBox();
})), })),
), ),
], ],

@ -94,6 +94,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
patient, patient,
arrivalType ?? '0', arrivalType ?? '0',
patientType, patientType,
@ -104,6 +105,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
: isDischargedPatient : isDischargedPatient
? 240 ? 240
: 0, : 0,
isDischargedPatient:isDischargedPatient
), ),
Container( Container(
height: !isSearchAndOut height: !isSearchAndOut

@ -1,9 +1,11 @@
import 'dart:ui'; import 'dart:ui';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.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';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -14,13 +16,22 @@ class PatientReferralScreen extends StatefulWidget {
_PatientReferralScreen createState() => _PatientReferralScreen(); _PatientReferralScreen createState() => _PatientReferralScreen();
} }
class _PatientReferralScreen extends State<PatientReferralScreen> class _PatientReferralScreen extends State<PatientReferralScreen> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
int index=0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 2, vsync: this); _tabController = TabController(length: 2, vsync: this);
_tabController.addListener(_handleTabSelection);
}
_handleTabSelection() {
setState(() {
index = _tabController.index;
});
} }
@override @override
@ -29,7 +40,7 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
_tabController.dispose(); _tabController.dispose();
} }
@override
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -39,12 +50,10 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
// backgroundColor: Colors.white, // backgroundColor: Colors.white,
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: Size.fromHeight(60.0), preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
child: Center( child: Center(
child: Container( child: Container(
height: 60.0, height: MediaQuery.of(context).size.height * 0.070,
// margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 1, // 0.92,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
@ -54,30 +63,71 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
color: Colors.white), color: Colors.white),
child: Center( child: Center(
child: TabBar( child: TabBar(
isScrollable: true, isScrollable: false,
controller: _tabController, controller: _tabController,
indicatorColor: Colors.red[800], indicatorColor: Colors.transparent,
indicatorWeight: 5.0, indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor,
labelPadding: labelPadding: EdgeInsets.only(top: 0, left:0, right: 0,bottom: 0),
EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
unselectedLabelColor: Colors.grey[800], unselectedLabelColor: Colors.grey[800],
tabs: [ tabs: [
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.50,
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
index == 0
? Color(0xFFD02127 )
: Color(0xFFEAEAEA),
index == 0 ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center( child: Center(
child: child: AppText(
AppText(TranslationBase.of(context).referral), TranslationBase.of(context).myReferredPatient,
fontSize: SizeConfig.textMultiplier * 1.8,
color: index == 0 ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
),
),
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.50,
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
index == 1
? Color(0xFFD02127 )
: Color(0xFFEAEAEA),
index == 1 ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center( child: Center(
child: AppText( child: AppText(
TranslationBase.of(context).myReferredPatient), TranslationBase.of(context).referral,
fontSize: SizeConfig.textMultiplier * 1.8,
color: index == 1 ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
), ),
), ),
),
),
], ],
), ),
), ),
@ -91,8 +141,8 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: <Widget>[ children: <Widget>[
MyReferralInPatientScreen(),
ReferredPatientScreen(), ReferredPatientScreen(),
MyReferralInPatientScreen(),
// MyReferredPatient(), // MyReferredPatient(),
], ],
), ),

@ -18,9 +18,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final String arrivalType; final String arrivalType;
final double height; final double height;
final bool isInpatient; final bool isInpatient;
final bool isDischargedPatient;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false}); this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -302,6 +303,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
"${TranslationBase.of(context).numOfDays}: ", "${TranslationBase.of(context).numOfDays}: ",
fontSize: 15, fontSize: 15,
), ),
if(isDischargedPatient)
AppText(
"${DateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700)
else
AppText( AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15, fontSize: 15,

@ -62,7 +62,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Container( return Container(
child: Expanded(
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
@ -182,7 +181,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
widget.removeAllergy( widget.removeAllergy(
items[index]); items[index]);
} else { } else {
// TODO add Allergy
MySelectedAllergy mySelectedAllergy = MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy( new MySelectedAllergy(
@ -394,7 +392,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
), ),
], ],
), ),
),
); );
} }

Loading…
Cancel
Save