pharmacy web services

merge-requests/44/head
unknown 6 years ago
parent 3f6599eb90
commit a59a2d5ad3

@ -1,5 +1,10 @@
const MAX_SMALL_SCREEN = 660; const MAX_SMALL_SCREEN = 660;
const BASE_URL = 'https://hmgwebservices.com/Services/';
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/]";
//Ibrahim Albitar
const BASE_URL = 'https://hmgwebservices.com/Services/';
const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems";

@ -0,0 +1,26 @@
//Ibrahim Albitar
class PharmaciesRequestModel {
String PHR_itemName;
int LanguageID;
String stamp;
String IPAdress;
double VersionID;
String TokenID;
String SessionID;
bool IsLoginForDoctorApp;
bool PatientOutSA;
int PatientTypeID;
PharmaciesRequestModel(
{this.PHR_itemName,
this.PatientTypeID,
this.LanguageID,
this.stamp,
this.IPAdress,
this.VersionID,
this.TokenID,
this.SessionID,
this.IsLoginForDoctorApp,
this.PatientOutSA});
}

@ -0,0 +1,30 @@
import 'dart:convert';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/pharmacies_request_model.dart';
import 'package:flutter/cupertino.dart';
class MedicineProvider with ChangeNotifier {
Future<Map> getPharmacyList(PharmaciesRequestModel pharmacy) async {
try {
final response = await AppClient.post(PHARMACY_ITEMS_URL,
body: json.encode({
"PHR_itemName": pharmacy.PHR_itemName,
"LanguageID": pharmacy.LanguageID,
"stamp": pharmacy.stamp,
"IPAdress": pharmacy.IPAdress,
"VersionID": pharmacy.VersionID,
"TokenID": pharmacy.TokenID,
"SessionID": pharmacy.SessionID,
"IsLoginForDoctorApp": pharmacy.IsLoginForDoctorApp,
"PatientOutSA": pharmacy.PatientOutSA,
"PatientTypeID": pharmacy.PatientTypeID
}));
return Future.value(json.decode(response.body));
} catch (error) {
throw error;
}
}
}

@ -30,7 +30,7 @@ const String PATIENTS = 'patients/patients';
const String PATIENTS_PROFILE = 'patients/patients-profile'; const String PATIENTS_PROFILE = 'patients/patients-profile';
const String BLOOD_BANK = 'blood-bank'; const String BLOOD_BANK = 'blood-bank';
const String DOCTOR_REPLY = 'doctor-reply'; const String DOCTOR_REPLY = 'doctor-reply';
const String MEDICINE_SEARCH = 'medicine-search'; const String MEDICINE_SEARCH = 'medicine/medicine-search';
const String SETTINGS = 'settings'; const String SETTINGS = 'settings';
var routes = { var routes = {

@ -23,217 +23,216 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle:'Home', appBarTitle: 'Home',
body: Container( body: Container(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: AppText( child: AppText(
"Today's Statistics", "Today's Statistics",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
)), )),
Expanded( Expanded(
flex: 3, flex: 3,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 2, flex: 2,
child: RoundedContainer(child:CircularPercentIndicator( child: RoundedContainer(
radius: 90.0, child: CircularPercentIndicator(
animation: true, radius: 90.0,
animationDuration: 1200, animation: true,
lineWidth: 7.0, animationDuration: 1200,
percent: .75, lineWidth: 7.0,
center: Column( percent: .75,
mainAxisAlignment: MainAxisAlignment.center, center: Column(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.center,
AppText( children: <Widget>[
"38", AppText("38",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 4 fontSize: SizeConfig.textMultiplier * 4),
), AppText("Out-Patients",
AppText( fontWeight: FontWeight.normal,
"Out-Patients", fontSize: SizeConfig.textMultiplier * 1.5,
fontWeight: FontWeight.normal, color: Colors.grey[800]),
fontSize: SizeConfig.textMultiplier * 1.5, ],
color: Colors.grey[800] ),
), circularStrokeCap: CircularStrokeCap.butt,
], backgroundColor: Colors.blueGrey[100],
), progressColor: Colors.red,
circularStrokeCap: CircularStrokeCap.butt, ))),
backgroundColor: Colors.blueGrey[100], Expanded(
progressColor: Colors.red, flex: 2,
))), child: Row(
Expanded( children: <Widget>[
flex: 2, Expanded(
child: Row( flex: 1,
children: <Widget>[ child: Column(
Expanded(
flex: 1,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"Arrived",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Not Arrived",
"23",
)),
],
)),
Expanded(
child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
"ER", "Arrived",
"23", "23",
)), )),
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
"Walk-in", "Not Arrived",
"23", "23",
)), )),
], ],
)), )),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"ER",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Walk-in",
"23",
)),
], ],
)) )),
])), ],
Expanded( ))
flex: 2, ])),
child: Row( Expanded(
crossAxisAlignment: CrossAxisAlignment.stretch, flex: 2,
children: <Widget>[ child: Row(
Expanded( crossAxisAlignment: CrossAxisAlignment.stretch,
flex: 2, children: <Widget>[
child: new DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"08", child: new DashboardItemIconText(
"Lab Result", DoctorApp.home_icon,
backgroundColor: Colors.red, "08",
)), "Lab Result",
Expanded( backgroundColor: Colors.red,
flex: 2, )),
child: new DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"10", child: new DashboardItemIconText(
"Radiology", DoctorApp.home_icon,
backgroundColor: Colors.red, "10",
)), "Radiology",
Expanded( backgroundColor: Colors.red,
flex: 2, )),
child: new DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"05", child: new DashboardItemIconText(
"Referral", DoctorApp.home_icon,
backgroundColor: Colors.red, "05",
)), "Referral",
], backgroundColor: Colors.red,
)), )),
Expanded( ],
flex: 2, )),
child: Row( Expanded(
crossAxisAlignment: CrossAxisAlignment.stretch, flex: 2,
children: <Widget>[ child: Row(
Expanded( crossAxisAlignment: CrossAxisAlignment.stretch,
flex: 2, children: <Widget>[
child: new DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"23", child: new DashboardItemIconText(
"In-Patient", DoctorApp.home_icon,
showBorder: true, "23",
)), "In-Patient",
Expanded( showBorder: true,
flex: 2, )),
child: new DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"23", child: new DashboardItemIconText(
"Operations", DoctorApp.home_icon,
showBorder: true, "23",
)), "Operations",
], showBorder: true,
)), )),
Expanded( ],
flex: 1, )),
child: Container( Expanded(
margin: EdgeInsets.all(10), flex: 1,
child: AppText( child: Container(
"Patient Services", margin: EdgeInsets.all(10),
fontWeight: FontWeight.bold, child: AppText(
), "Patient Services",
alignment: Alignment.centerLeft, fontWeight: FontWeight.bold,
)), ),
Expanded( alignment: Alignment.centerLeft,
flex: 2, )),
child: Row( Expanded(
crossAxisAlignment: CrossAxisAlignment.stretch, flex: 2,
children: <Widget>[ child: Row(
Expanded( crossAxisAlignment: CrossAxisAlignment.stretch,
flex: 2, children: <Widget>[
child: InkWell( child: DashboardItemIconText( Expanded(
DoctorApp.home_icon, flex: 2,
"", child: InkWell(
"Search Patient", child: DashboardItemIconText(
showBorder: false, DoctorApp.home_icon,
backgroundColor: Colors.green[200], "",
), "Search Patient",
showBorder: false,
onTap: () { backgroundColor: Colors.green[200],
Navigator.of(context).pushNamed(PATIENT_SEARCH); ),
}, onTap: () {
Navigator.of(context).pushNamed(PATIENT_SEARCH);
)), },
Expanded( )),
flex: 2, Expanded(
child: new DashboardItemIconText( flex: 2,
DoctorApp.home_icon, child: InkWell(
"", child: DashboardItemIconText(
"Out Patient", DoctorApp.home_icon,
showBorder: false, "",
backgroundColor: Colors.deepPurple[300], "Out Patient",
)), showBorder: false,
], backgroundColor: Colors.deepPurple[300],
)), ),
Expanded( onTap: () {
flex: 2, Navigator.of(context).pushNamed(MEDICINE_SEARCH);
child: Row( },
crossAxisAlignment: CrossAxisAlignment.stretch, )),
children: <Widget>[ ],
Expanded( )),
flex: 2, Expanded(
child: new DashboardItemIconText( flex: 2,
DoctorApp.home_icon, child: Row(
"", crossAxisAlignment: CrossAxisAlignment.stretch,
"In Patient", children: <Widget>[
showBorder: false, Expanded(
backgroundColor: Colors.blueGrey[900], flex: 2,
)), child: new DashboardItemIconText(
Expanded( DoctorApp.home_icon,
flex: 2, "",
child: new DashboardItemIconText( "In Patient",
DoctorApp.home_icon, showBorder: false,
"", backgroundColor: Colors.blueGrey[900],
"Discharge Patient", )),
showBorder: false, Expanded(
backgroundColor: Colors.brown[400], flex: 2,
)), child: new DashboardItemIconText(
], DoctorApp.home_icon,
)), "",
], "Discharge Patient",
))); showBorder: false,
backgroundColor: Colors.brown[400],
)),
],
)),
],
)));
} }
} }

@ -1,9 +1,67 @@
import 'package:doctor_app_flutter/models/pharmacies_request_model.dart';
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class MedicineSearchScreen extends StatelessWidget { import 'package:provider/provider.dart';
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg {
MedicineSearchScreen({this.changeLoadingStata});
final Function changeLoadingStata;
@override
_MedicineSearchState createState() => _MedicineSearchState();
}
class _MedicineSearchState extends State<MedicineSearchScreen> {
var _medicineModel = PharmaciesRequestModel(
IsLoginForDoctorApp: true,
PHR_itemName: "Panadol",
PatientOutSA: false,
PatientTypeID: 1,
LanguageID: 2,
IPAdress: "11.11.11.11",
VersionID: 1.2,
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
stamp: "2020-04-23T21:01:21.492Z",
SessionID: "e29zoooEJ4");
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return ChangeNotifierProvider(
create: (context) => MedicineProvider(), //change builder to create
); child: Consumer<MedicineProvider>(
builder: (context, provider, child) => AppScaffold(
appBarTitle: "Search Medicine",
body: RaisedButton(
onPressed: () {
MedicineProvider medicineProvider =
Provider.of<MedicineProvider>(context);
searchMedicine(context, medicineProvider);
},
))));
}
searchMedicine(
context, MedicineProvider medicineProvider) {
medicineProvider.getPharmacyList(_medicineModel).then((res) {
if (res['MessageStatus'] == 1) {
print("ListPharmcy " + res['ListPharmcy'].toString());
//Navigator.of(context).pushNamed();
} else {
// handel error
// widget.showCenterShortLoadingToast("watting");
//helpers.showErrorToast(res['ErrorEndUserMessage']);
}
// Navigator.of(context).pushNamed(HOME);
}).catchError((err) {
print('$err');
//helpers.showErrorToast();
});
} }
} }

Loading…
Cancel
Save