working on referral page

merge-requests/402/head
mosazaid 5 years ago
parent f280ed731d
commit f57a5bbcef

@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660;
const ONLY_NUMBERS = "[0-9]"; const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = const PATIENT_PROGRESS_NOTE_URL =

@ -333,7 +333,7 @@ const Map<String, Map<String, String>> localizedValues = {
'branch': {'en': "Branch", 'ar': 'الفرع'}, 'branch': {'en': "Branch", 'ar': 'الفرع'},
'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'}, 'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'},
'appointmentNo': {'en': "Appointment # : ", 'ar': '# الموعد:'}, 'appointmentNo': {'en': "Appointment # : ", 'ar': '# الموعد:'},
'refer': {'en': "REFER", 'ar': 'إحالة'}, 'refer': {'en': "Refer", 'ar': 'إحالة'},
'rejected': {'en': "Rejected", 'ar': 'مرفوض'}, 'rejected': {'en': "Rejected", 'ar': 'مرفوض'},
'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'}, 'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'},
'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'}, 'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'},

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -9,6 +10,8 @@ import 'package:doctor_app_flutter/util/helpers.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/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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';
@ -46,6 +49,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
referToList = List(); referToList = List();
dynamic sameBranch = { dynamic sameBranch = {
@ -66,46 +71,69 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
/*if (model.state == ViewState.BusyLocal)
Container(
color: Colors.white,
width: 50,
height: 50,
child: AppLoaderWidget(
containerColor: Colors.white,
)),*/
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PatientProfileHeaderNewDesign(
patient, patientType, arrivalType),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
PatientPageHeaderWidget(patient), AppText(
const Divider( "${TranslationBase.of(context).refer}",
color: Color(0xffCCCCCC), fontFamily: 'Poppins',
height: 1, fontSize: SizeConfig.textMultiplier * 1.6,
thickness: 2, fontWeight: FontWeight.w600,
indent: 0, ),
endIndent: 0, AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
), ),
model.patientReferral.length == 0 model.patientReferral.length == 0
? ReferralForm(model, screenSize) ? referralForm(model, screenSize)
: PatientReferralItemWidget( : PatientReferralItemWidget(
"${model.patientReferral[model.patientReferral.length -1].patientID}", "${model.patientReferral[model.patientReferral.length - 1].patientID}",
patientName: model.patientReferral[model.patientReferral.length -1].patientName, patientName: model
.patientReferral[
model.patientReferral.length - 1]
.patientName,
referralStatus: referralStatus:
"${model.patientReferral[model.patientReferral.length -1].referralStatus}", "${model.patientReferral[model.patientReferral.length - 1].referralStatus}",
isReferredTo: true, isReferredTo: true,
isSameBranch: model isSameBranch: model
.patientReferral[model.patientReferral.length -1].isReferralDoctorSameBranch, .patientReferral[
referralDoctorName: model.patientReferral.length - 1]
model.patientReferral[model.patientReferral.length -1].referredByDoctorInfo, .isReferralDoctorSameBranch,
referralDoctorName: model
.patientReferral[
model.patientReferral.length - 1]
.referredByDoctorInfo,
clinicDescription: null, clinicDescription: null,
remark: model.patientReferral[model.patientReferral.length -1].remarksFromSource, remark: model
referredOn: model.patientReferral[model.patientReferral.length -1].referredOn, .patientReferral[
answerFromTarget: model.patientReferral.length - 1]
model.patientReferral[model.patientReferral.length -1].answerFromTarget, .remarksFromSource,
referredOn: model
.patientReferral[
model.patientReferral.length - 1]
.referredOn,
answerFromTarget: model
.patientReferral[
model.patientReferral.length - 1]
.answerFromTarget,
), ),
], ],
), ),
@ -114,7 +142,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton( child: AppButton(
title: TranslationBase.of(context).refer, title: TranslationBase.of(context).refer,
color: HexColor("#B8382B"), fontWeight: FontWeight.w700,
color: HexColor("#359846"),
onPressed: () { onPressed: () {
if (appointmentDate == null || if (appointmentDate == null ||
_selectedBranch == null || _selectedBranch == null ||
@ -145,27 +174,19 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
Widget ReferralForm(PatientReferralViewModel model, Size screenSize) { Widget referralForm(PatientReferralViewModel model, Size screenSize) {
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( AppTextFieldCustom(
height: 16, height: screenSize.height * 0.075,
), hintText: TranslationBase.of(context).branch,
AppText( dropDownText: _referTo != null ? _referTo['name'] : null,
TranslationBase.of(context).referPatient, enabled: false,
fontWeight: FontWeight.bold, isDropDown: true,
fontSize: 16, onClick: referToList != null
),
SizedBox(
height: 16,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: referToList != null
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: referToList, list: referToList,
@ -185,11 +206,12 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
await model await model
.getClinics(_selectedBranch['facilityId']) .getClinics(_selectedBranch['facilityId'])
.then((_) => .then((_) =>
GifLoaderDialogUtils.hideDialog( GifLoaderDialogUtils.hideDialog(context));
context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
} else {
_selectedBranch = null;
} }
}); });
}); });
@ -204,22 +226,19 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
: null, : null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referTo,
_referTo != null ? _referTo['name'] : null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).hospital,
onTap: model.branchesList != null && dropDownText: _selectedBranch != null
? _selectedBranch['facilityName']
: null,
enabled: false,
isDropDown: true,
onClick: model.branchesList != null &&
model.branchesList.length > 0 && model.branchesList.length > 0 &&
_referTo != null && _referTo != null &&
_referTo['id'] == 2 _referTo['id'] == 2
@ -254,24 +273,19 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
: null, : null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).branch,
_selectedBranch != null
? _selectedBranch['facilityName']
: null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).clinic,
onTap: _selectedBranch != null && dropDownText: _selectedClinic != null
? _selectedClinic['ClinicDescription']
: null,
enabled: false,
isDropDown: true,
onClick: _selectedBranch != null &&
model.clinicsList != null && model.clinicsList != null &&
model.clinicsList.length > 0 model.clinicsList.length > 0
? () { ? () {
@ -280,8 +294,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
attributeName: 'ClinicDescription', attributeName: 'ClinicDescription',
attributeValueId: 'ClinicID', attributeValueId: 'ClinicID',
usingSearch: true, usingSearch: true,
hintSearchText: hintSearchText: TranslationBase.of(context).clinicSearch,
TranslationBase.of(context).clinicSearch,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() async { setState(() async {
@ -308,24 +321,18 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
: null, : null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).clinic,
_selectedClinic != null
? _selectedClinic['ClinicDescription']
: null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).doctor,
onTap: _selectedClinic != null && dropDownText:
_selectedDoctor != null ? _selectedDoctor['DoctorName'] : null,
enabled: false,
isDropDown: true,
onClick: _selectedClinic != null &&
model.doctorsList != null && model.doctorsList != null &&
model.doctorsList.length > 0 model.doctorsList.length > 0
? () { ? () {
@ -334,8 +341,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
attributeName: 'DoctorName', attributeName: 'DoctorName',
attributeValueId: 'DoctorID', attributeValueId: 'DoctorID',
usingSearch: true, usingSearch: true,
hintSearchText: hintSearchText: TranslationBase.of(context).doctorSearch,
TranslationBase.of(context).doctorSearch,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
@ -352,55 +358,37 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
: null, : null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).doctor,
_selectedDoctor != null
? _selectedDoctor['DoctorName']
: null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).date,
onTap: () => _selectDate(context, model), dropDownText: appointmentDate != null
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).chooseAppointment,
appointmentDate != null
? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}"
: null, : null,
true, enabled: false,
isDropDown: true,
suffixIcon: Icon( suffixIcon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
)),
enabled: false,
),
), ),
onClick: (){
_selectDate(context, model);
},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
child: TextField( hintText:
decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).dietTypeRemarks,
TranslationBase.of(context).remarks, null, false),
enabled: true,
controller: _remarksController, controller: _remarksController,
// inputFormatters: [ inputType: TextInputType.multiline,
// FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS))
// ],
keyboardType: TextInputType.text,
minLines: 4, minLines: 4,
maxLines: 6, maxLines: 6,
)), ),
], ],
), ),
); );

Loading…
Cancel
Save