Merge branch 'clinic_list' into 'development'

Clinic list

See merge request Cloud_Solution/doctor_app_flutter!362
merge-requests/363/merge
Mohammad Aljammal 5 years ago
commit e2e3cd9a29

@ -748,6 +748,8 @@ const Map<String, Map<String, String>> localizedValues = {
},
'appointmentDate': {'en': "Appointment Date", 'ar': "تاريخ الموعد"},
'arrived_p': {'en': "Arrived", 'ar': "وصل"},
"open-rad": {"en": "Open Image", "ar": "فتح صور الاشعة"},
'fileNumber': {'en': "File Number: ", 'ar': " :رقم الملف"},
'searchPatient-name': {
'en': 'Search Name, Medical File, Phone Number',

@ -11,7 +11,7 @@ class MedicineService extends BaseService {
var _pharmaciesList = [];
get pharmacyItemsList => _pharmacyItemsList;
get pharmaciesList => _pharmaciesList;
String searchText='';
List<GetAssessmentResModel> patientAssessmentList = [];
PharmaciesItemsRequestModel _itemsRequestModel =
@ -20,6 +20,7 @@ class MedicineService extends BaseService {
Future getMedicineItem(String itemName) async {
_itemsRequestModel.pHRItemName = itemName;
searchText =itemName;
await baseAppClient.post(
PHARMACY_ITEMS_URL,
onSuccess: (dynamic response, int statusCode) {

@ -15,7 +15,7 @@ class MedicineViewModel extends BaseViewModel {
PrescriptionService _prescriptionService = locator<PrescriptionService>();
get pharmacyItemsList => _medicineService.pharmacyItemsList;
get searchText=>_medicineService.searchText;
get pharmaciesList => _medicineService.pharmaciesList;
get medicationStrengthList => _prescriptionService.medicationStrengthList;
@ -34,6 +34,7 @@ class MedicineViewModel extends BaseViewModel {
List<GetAssessmentResModel> get patientAssessmentList =>
_prescriptionService.patientAssessmentList;
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
@ -41,6 +42,7 @@ class MedicineViewModel extends BaseViewModel {
_prescriptionService.itemMedicineListRoute;
List<dynamic> get itemMedicineListUnit =>
_prescriptionService.itemMedicineListUnit;
Future getItem({int itemID}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();

@ -1,10 +1,10 @@
import 'dart:math';
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
@ -12,13 +12,13 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.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_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_recognition_result.dart';
@ -117,149 +117,169 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
Widget build(BuildContext context) {
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
if (model.allMedicationList.length == 0)
await model.getMedicationList();
// if (model.allMedicationList.length == 0)
// await model.getMedicationList();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).searchMedicine,
body: SingleChildScrollView(
child: FractionallySizedBox(
widthFactor: 0.97,
child: SingleChildScrollView(
child: Container(
color: Colors.white,
// height: SizeConfig.screenHeight,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(height: 100),
Column(children: [
FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: <Widget>[
Container(
child: InkWell(
onTap: model.allMedicationList != null
? () {
setState(() {
_selectedMedication = null;
});
}
: null,
child: _selectedMedication == null
? AutoCompleteTextField<
GetMedicationResponseModel>(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicineNameHere,
_selectedMedication != null
? _selectedMedication.genericName
: null,
true,
icon: EvaIcons.search),
itemSubmitted: (item) => setState(
() => _selectedMedication = item),
key: key,
suggestions: model.allMedicationList,
itemBuilder: (context, suggestion) =>
new Padding(
child: Texts(
suggestion.description +
'/' +
suggestion.genericName),
padding: EdgeInsets.all(10.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.genericName
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(input.toLowerCase()),
)
: TextField(
minLines: 2,
maxLines: 2,
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicineNameHere,
_selectedMedication != null
? _selectedMedication
.description +
(' (${_selectedMedication.genericName} )')
: null,
true,
icon: EvaIcons.search),
enabled: false,
),
builder: (_, model, w) {
myController.text =model.searchText;
return AppScaffold(
// baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).searchMedicine,
body: SingleChildScrollView(
child: FractionallySizedBox(
widthFactor: 0.97,
child: SingleChildScrollView(
child: Container(
// height: SizeConfig.screenHeight,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(
height: SizeConfig.screenHeight * .16,
),
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
borderColor: Colors.white,
hintText: TranslationBase.of(context)
.searchMedicineNameHere,
controller: myController,
onSaved: (value) {},
onFieldSubmitted: (value) {
searchMedicine(context, model);
},
inputFormatter: ONLY_LETTERS,
),
),
],
),
)
]),
SizedBox(
height: SizeConfig.screenHeight * .55,
),
Column(
children: [
FractionallySizedBox(
widthFactor: 0.97,
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
// TODO change it secondary button and add loading
AppButton(
title: TranslationBase.of(context).search,
onPressed: () async {
await searchMedicine(context, model);
},
),
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
// TODO change it secondary button and add loading
AppButton(
title: TranslationBase.of(context).search,
onPressed: () async{
await searchMedicine(context, model);
},
),
],
),
],
),
),
Container(
margin: EdgeInsets.only(
left: SizeConfig.heightMultiplier * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase
.of(context)
.youCanFind +
(myController.text !=''?model.pharmacyItemsList.length
.toString():'0' )+
" " +
TranslationBase
.of(context)
.itemsInSearch,
fontWeight: FontWeight.bold,
),
],
),
),
SizedBox(
height:10,
),
)
],
)
],
),
)),
if(myController.text !='')
Container(
height: MediaQuery
.of(context)
.size
.height * 0.5,
child: ListView.builder(
padding: const EdgeInsets.only(top:20),
scrollDirection: Axis.vertical,
// shrinkWrap: true,
itemCount:
model.pharmacyItemsList ==
null
? 0
: model
.pharmacyItemsList.length,
itemBuilder:
(BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label: model
.pharmacyItemsList[index]
["ItemDescription"],
url: model
.pharmacyItemsList[index]
["ImageSRCUrl"],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PharmaciesListScreen(
itemID: model
.pharmacyItemsList[
index]["ItemID"],
url: model
.pharmacyItemsList[
index]["ImageSRCUrl"]),
),
);
},
);
},
),
),
],
),
)),
),
),
),
),
);}
);
}
searchMedicine(context, MedicineViewModel model) async {
FocusScope.of(context).unfocus();
if (_selectedMedication.isNullOrEmpty()) {
helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
if (myController.text.isNullOrEmpty()) {
helpers.showErrorToast(TranslationBase
.of(context)
.typeMedicineName);
//"Type Medicine Name")
return;
} else if (_selectedMedication.description.length < 3) {
helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter);
}
if (myController.text.length < 3) {
helpers.showErrorToast(TranslationBase
.of(context)
.moreThan3Letter);
return;
}
// GifLoaderDialogUtils.showMyDialog(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PharmaciesListScreen(
itemID: _selectedMedication.itemId,
selectedMedication: _selectedMedication,
),
),
);
// await model.getMedicineItem(_selectedMedication.description);
// GifLoaderDialogUtils.hideDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await model.getMedicineItem(myController.text);
GifLoaderDialogUtils.hideDialog(context);
}
startVoiceSearch() {

@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:typed_data';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -23,11 +22,9 @@ class PharmaciesListScreen extends StatefulWidget {
final int itemID;
final String url;
final GetMedicationResponseModel selectedMedication;
// In the constructor, require a item id.
PharmaciesListScreen(
{Key key, @required this.itemID, this.url, this.selectedMedication})
PharmaciesListScreen({Key key, @required this.itemID, this.url})
: super(key: key);
@override
@ -52,39 +49,31 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Widget build(BuildContext context) {
projectsProvider = Provider.of(context);
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
await model.getPharmaciesList(widget.selectedMedication.itemId);
await model.getMedicineItem(widget.selectedMedication.description);
},
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase
.of(context)
.pharmaciesList,
body: Container(
height: SizeConfig.screenHeight,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[
model.pharmaciesList.length > 0 && model.pharmacyItemsList.length > 0
onModelReady: (model) => model.getPharmaciesList(widget.itemID),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).pharmaciesList,
body: Container(
height: SizeConfig.screenHeight,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[
model.pharmaciesList.length > 0
? RoundedContainer(
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: model.pharmacyItemsList[0]
["ImageSRCUrl"]!= null
? Image.network(
model.pharmacyItemsList[0]["ImageSRCUrl"],
height:
SizeConfig.imageSizeMultiplier *
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: widget.url != null
? Image.network(
widget.url,
height:
SizeConfig.imageSizeMultiplier *
21,
width:
SizeConfig.imageSizeMultiplier *
@ -241,8 +230,8 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
}),
),
)
]),
),),);
]),
),),);
}
@ -253,7 +242,7 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
//TODO CHECK THE URL IS NULL OR NOT
Uint8List dataFromBase64String(String base64String) {
if(base64String !=null)
return base64Decode(base64String);
return base64Decode(base64String);
}
String base64String(Uint8List data) {

@ -516,6 +516,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
.getFrom,
"to":
patient.getTo,
"isSearch":isSearch
});
},
);

@ -1,37 +1,76 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:url_launcher/url_launcher.dart';
class RadiologyReportScreen extends StatelessWidget {
final String reportData;
final String url;
RadiologyReportScreen({Key key, this.reportData});
RadiologyReportScreen({Key key, this.reportData, this.url});
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).radiologyReport,
body: Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.white,
border: Border(
bottom: BorderSide(color: Colors.grey, width: 0.5),
top: BorderSide(color: Colors.grey, width: 0.5),
left: BorderSide(color: Colors.grey, width: 0.5),
right: BorderSide(color: Colors.grey, width: 0.5),
appBarTitle: TranslationBase.of(context).radiologyReport,
body: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.white,
border: Border(
bottom: BorderSide(color: Colors.grey, width: 0.5),
top: BorderSide(color: Colors.grey, width: 0.5),
left: BorderSide(color: Colors.grey, width: 0.5),
right: BorderSide(color: Colors.grey, width: 0.5),
),
),
child: AppText(
reportData,
fontSize: 2.5 * SizeConfig.textMultiplier,
),
),
SizedBox(height:MediaQuery.of(context).size.height * 0.13 ,)
],
),
),
child: AppText(
reportData,
fontSize: 2.5 * SizeConfig.textMultiplier,
),
),
);
bottomSheet: url == null
? Container(
height: MediaQuery.of(context).size.height * 0,
)
: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.1,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
// TODO change it secondary button and add loading
AppButton(
title: TranslationBase.of(context).openRad,
onPressed: () async {
launch(url);
},
),
],
),
),
),
],
),
));
}
}

@ -102,6 +102,8 @@ class _RadiologyScreenState extends State<RadiologyScreen> {
reportData: model
.patientRadiologyList[index]
.reportData,
url: model
.patientRadiologyList[index].imageURL,
)),
);
},

@ -1141,6 +1141,8 @@ class TranslationBase {
String get fileNumber => localizedValues['fileNumber'][locale.languageCode];
String get reschedule => localizedValues['reschedule'][locale.languageCode];
String get leaves => localizedValues['leaves'][locale.languageCode];
String get openRad => localizedValues['open-rad'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -17,13 +17,13 @@ class AppScaffold extends StatelessWidget {
final bool isLoading;
final bool isShowAppBar;
final BaseViewModel baseViewModel;
final Widget bottomSheet;
AppScaffold(
{this.appBarTitle = '',
this.body,
this.isLoading = false,
this.isShowAppBar = true,
this.baseViewModel});
this.baseViewModel, this.bottomSheet});
@override
Widget build(BuildContext context) {
@ -59,6 +59,8 @@ class AppScaffold extends StatelessWidget {
],
)
: null,
bottomSheet: bottomSheet,
body: projectProvider.isInternetConnection
? baseViewModel != null
? NetworkBaseView(

Loading…
Cancel
Save