Conflicts:
	lib/client/base_app_client.dart
	lib/screens/auth/login_screen.dart
	lib/widgets/auth/login_form.dart
	lib/widgets/auth/verfiy_account.dart
merge-requests/109/head
Mohammad ALjammal 6 years ago
commit 06f2aaef4b

Binary file not shown.

@ -34,20 +34,6 @@
"male" "male"
] ]
}, },
{
"uid": "0bbb324cc39e62b3a4e05639a4f4008f",
"css": "home_icon",
"code": 59394,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M973.1 435L973.1 435 565 27A92 92 0 0 0 434.9 27L27.2 434.7 26.8 435.1A92 92 0 0 0 88 591.9C88.9 591.9 89.9 591.9 90.8 591.9H107.1V892.1A107.9 107.9 0 0 0 214.8 999.9H374.4A29.3 29.3 0 0 0 403.7 970.6V735.3A49.2 49.2 0 0 1 452.9 686.2H547A49.2 49.2 0 0 1 596.2 735.3V970.7A29.3 29.3 0 0 0 625.5 1000H785.1A107.9 107.9 0 0 0 892.8 892.3V592H907.8A92.1 92.1 0 0 0 973 434.9ZM931.6 523.7A33.4 33.4 0 0 1 907.9 533.5H863.5A29.3 29.3 0 0 0 834.2 562.8V892.3A49.2 49.2 0 0 1 785.1 941.4H654.9V735.3A107.9 107.9 0 0 0 547 627.5H452.9A107.9 107.9 0 0 0 345.1 735.2V941.3H215A49.2 49.2 0 0 1 165.8 892.1V562.8A29.3 29.3 0 0 0 136.5 533.5H92.8L91.4 533.5A33.4 33.4 0 0 1 68.4 476.4H68.4L476.3 68.4A33.4 33.4 0 0 1 523.6 68.4L931.4 476.2 931.6 476.4A33.4 33.4 0 0 1 931.6 523.7ZM931.6 523.7",
"width": 1000
},
"search": [
"home_icon"
]
},
{ {
"uid": "06d6838cdcf6af812f2eb51e0269afc0", "uid": "06d6838cdcf6af812f2eb51e0269afc0",
"css": "home_icon_active", "css": "home_icon_active",
@ -145,6 +131,62 @@
"search": [ "search": [
"schedule_icon" "schedule_icon"
] ]
},
{
"uid": "5a324eddf382f5a1167d7d40325f82c8",
"css": "reject_icon",
"code": 59402,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M681 626.7L554.3 500 681 373.3A38.5 38.5 0 0 0 626.7 318.9L500 445.7 373.3 319A38.5 38.5 0 1 0 318.9 373.3L445.7 500 318.9 626.8A37.2 37.2 0 0 0 318.9 681.1 38.2 38.2 0 0 0 373.3 681.1L500 554.4 626.7 681.1A38.5 38.5 0 0 0 681.1 681.1 38.2 38.2 0 0 0 681 626.7ZM500 67.3A432.5 432.5 0 1 1 194 194 429.8 429.8 0 0 1 500 67.3M500 0A500 500 0 1 0 1000 500 500 500 0 0 0 500 0Z",
"width": 1000
},
"search": [
"reject_icon"
]
},
{
"uid": "2742f64b5e69cc4f39a2dcc5a081ad03",
"css": "approved_icon",
"code": 59403,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M756.3 348.3L714 304.8A9.1 9.1 0 0 0 707.2 302H707.2A8.7 8.7 0 0 0 700.5 304.8L407.2 600.3 300.5 493.5A9.3 9.3 0 0 0 287.1 493.5L244.2 536.3A9.6 9.6 0 0 0 244.2 550L378.8 684.5A42.6 42.6 0 0 0 406.9 698.2 44.6 44.6 0 0 0 434.8 685H435L756.5 362A10.3 10.3 0 0 0 756.3 348.3ZM500 67.3A432.5 432.5 0 1 1 194 194 429.8 429.8 0 0 1 500 67.3M500 0A499.9 499.9 0 1 0 999.9 500 499.9 499.9 0 0 0 500 0Z",
"width": 1000
},
"search": [
"approved_icon"
]
},
{
"uid": "148de09f7fd22c378cdfdbaacaa8e205",
"css": "pending_icon",
"code": 59404,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M809.8 932H797.3C781.5 932 768.2 929.8 766.5 914V913.7C731 583.9 523.3 577.6 523.3 499.9S731.1 415.9 766.5 86V85.9C768.2 70.1 781.5 68 797.3 68H809.8A34.8 34.8 0 0 0 844.7 35.7 34 34 0 0 0 810.7 0H35A34.8 34.8 0 0 0 0 32.3 34 34 0 0 0 34 68H47.2C63 68 76.3 70.2 78.1 85.9V86.2C113.7 416 321.5 422.3 321.5 500S113.7 584 78.3 913.8V914C76.6 929.8 63.3 932 47.5 932H35A34.8 34.8 0 0 0 0.1 964.3 34 34 0 0 0 34.1 1000H810.7A33.9 33.9 0 0 0 844.7 964.3 34.8 34.8 0 0 0 809.8 932ZM197.4 848.9C267 655.2 390.6 678.7 390.6 602.3V467.5C390.6 420.4 301.2 387.6 245.4 311.1A19 19 0 0 1 261.2 281H583.8A18.9 18.9 0 0 1 600 310.6C545.2 387.3 454.2 420.4 454.2 467.4V602.4C454.2 678.1 572.9 657.5 647.8 849 654.7 866.3 649.5 887.8 631.2 887.8H214.1C195.4 887.8 191.1 866.5 197.4 849Z",
"width": 845
},
"search": [
"pending_icon"
]
},
{
"uid": "0bbb324cc39e62b3a4e05639a4f4008f",
"css": "home_icon",
"code": 59394,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M973.1 435L973.1 435 565 27A92 92 0 0 0 434.9 27L27.2 434.7 26.8 435.1A92 92 0 0 0 88 591.9C88.9 591.9 89.9 591.9 90.8 591.9H107.1V892.1A107.9 107.9 0 0 0 214.8 999.9H374.4A29.3 29.3 0 0 0 403.7 970.6V735.3A49.2 49.2 0 0 1 452.9 686.2H547A49.2 49.2 0 0 1 596.2 735.3V970.7A29.3 29.3 0 0 0 625.5 1000H785.1A107.9 107.9 0 0 0 892.8 892.3V592H907.8A92.1 92.1 0 0 0 973 434.9ZM931.6 523.7A33.4 33.4 0 0 1 907.9 533.5H863.5A29.3 29.3 0 0 0 834.2 562.8V892.3A49.2 49.2 0 0 1 785.1 941.4H654.9V735.3A107.9 107.9 0 0 0 547 627.5H452.9A107.9 107.9 0 0 0 345.1 735.2V941.3H215A49.2 49.2 0 0 1 165.8 892.1V562.8A29.3 29.3 0 0 0 136.5 533.5H92.8L91.4 533.5A33.4 33.4 0 0 1 68.4 476.4H68.4L476.3 68.4A33.4 33.4 0 0 1 523.6 68.4L931.4 476.2 931.6 476.4A33.4 33.4 0 0 1 931.6 523.7ZM931.6 523.7",
"width": 1000
},
"search": [
"home_icon"
]
} }
] ]
} }

@ -0,0 +1,18 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/interceptor/http_interceptor.dart';
import 'package:http/http.dart';
// OWNER : Ibrahim albitar
// DATE : 22-04-2020
// DESCRIPTION : Custom App client to pin base url for all srvices
class AppClient {
static Client client = HttpInterceptor().getClient();
static Future<Response> post(dynamic path, {dynamic body}) async {
String _fullUrl = BASE_URL + path;
final response = await client.post(_fullUrl, body: body);
return response;
}
}

@ -37,9 +37,6 @@ class BaseAppClient {
Function(String error, int statusCode) onFailure, Function(String error, int statusCode) onFailure,
}) async { }) async {
String url = BASE_URL + endPoint; String url = BASE_URL + endPoint;
RequestData data = RequestData(body: body,baseUrl: url,method: Method.POST);
try { try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
@ -76,8 +73,7 @@ class BaseAppClient {
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
if (!parsed['IsAuthenticated']) { if (!parsed['IsAuthenticated']) {
await helpers.logout(); Navigator.of(AppGlobal.CONTEX).pushNamed(LOGIN);
helpers.showErrorToast('Your session expired Please login agian'); helpers.showErrorToast('Your session expired Please login agian');
} else if (parsed['MessageStatus'] == 1) { } else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);

@ -1,8 +1,8 @@
const MAX_SMALL_SCREEN = 660; 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/Services/'; const BASE_URL = 'https://hmgwebservices.com/Services/';
//const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; //const BASE_URL = 'https://uat.hmgwebservices.com/Services/';
const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region";
const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList";
@ -68,7 +68,3 @@ const PATIENT_OUT_SA = false;
/// Timer Info /// Timer Info
const TIMER_MIN =10; const TIMER_MIN =10;
class AppGlobal{
static var CONTEX;
}

@ -0,0 +1,65 @@
import 'dart:convert';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/providers/auth_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:http/http.dart';
import 'package:http_interceptor/http_interceptor.dart';
import '../providers/auth_provider.dart';
import '../util/dr_app_shared_pref.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
List<String> publicUrls = [
LOGIN_URL,
SELECT_DEVICE_IMEI,
MEMBER_CHECK_ACTIVATION_CODE_NEW,
SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE
];
class HttpInterceptor extends InterceptorContract {
Client getClient(){
return HttpClientWithInterceptor.build(interceptors: [this]);
}
Future<RequestData> interceptRequest({RequestData data}) async {
print('RequestData ${data.body}');
print('RequestData ${data.url}');
try {
data.headers["Content-Type"] = "application/json";
data.headers["Accept"] = "application/json";
// if (publicUrls.contains(data.url)) {
// var loggedUserInfo = await sharedPref.getObj('loggedUser');
// var token = await sharedPref.getString(TOKEN);
// // print("token"+token);
// // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}');
// // // the sevices handel the token in differat name so I ask to be change
// // // we must change the imple
// var body = json.decode(data.body);
// body['LogInTokenID']=token;
// data.body = json.encode(body);
// // data.body['LogInTokenID'] = '';
// } else {
// if (data.body['LogInTokenID']) {
// data.body['LogInTokenID'] = '';
// }
// if (data.body['TokenID']) {
// data.body['TokenID'] = '';
// }
// }
} catch (e) {
print(e);
}
// print('data.body${data.body}');
return data;
}
@override
Future<ResponseData> interceptResponse({ResponseData data}) async {
// print('ResponseData ${data.body}');
return data;
}
}

@ -1,3 +1,5 @@
import 'package:flutter/cupertino.dart';
class ReferToDoctorRequest { class ReferToDoctorRequest {
/* /*
@ -64,27 +66,27 @@ class ReferToDoctorRequest {
*/ */
ReferToDoctorRequest( ReferToDoctorRequest(
{this.projectID, {@required this.projectID,
this.admissionNo, @required this.admissionNo,
this.roomID = "ISO-6", @required this.roomID ,
this.referralClinic, @required this.referralClinic,
this.referralDoctor , @required this.referralDoctor ,
this.createdBy, @required this.createdBy,
this.editedBy , @required this.editedBy ,
this.patientID, @required this.patientID,
this.patientTypeID = 1, @required this.patientTypeID,
this.referringClinic, @required this.referringClinic,
this.referringDoctor, @required this.referringDoctor,
this.referringDoctorRemarks, @required this.referringDoctorRemarks,
this.priority , @required this.priority ,
this.frequency, @required this.frequency,
this.extension, @required this.extension,
this.languageID = 2, this.languageID = 2,
this.stamp = "2020-06-03T11:26:42.358Z", this.stamp = "2020-06-03T11:26:42.358Z",
this.iPAdress = "11.11.11.11", this.iPAdress = "11.11.11.11",
this.versionID = 1.2, this.versionID = 1.2,
this.channel = 9, this.channel = 9,
this.tokenID, @required this.tokenID,
this.sessionID = "JBXRsDl37L", this.sessionID = "JBXRsDl37L",
this.isLoginForDoctorApp = true, this.isLoginForDoctorApp = true,
this.patientOutSA = false}); this.patientOutSA = false});

@ -31,4 +31,7 @@ class DoctorApp {
static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData reject_icon = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
} }

@ -1,108 +1,86 @@
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'dart:convert';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../models/user_model.dart'; import '../models/user_model.dart';
const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New'; const LOGIN_URL =
const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; 'Sentry.svc/REST/MemberLogIN_New';
const INSERT_DEVICE_IMEI =
'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const SELECT_DEVICE_IMEI = const SELECT_DEVICE_IMEI =
'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType';
const MEMBER_CHECK_ACTIVATION_CODE_NEW = const MEMBER_CHECK_ACTIVATION_CODE_NEW ='Sentry.svc/REST/MemberCheckActivationCode_New';
'Sentry.svc/REST/MemberCheckActivationCode_New';
const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles';
class AuthProvider with ChangeNotifier { class AuthProvider with ChangeNotifier {
Future<dynamic> login(UserModel userInfo) async { Future<Map> login(UserModel userInfo) async {
try { const url = LOGIN_URL;
dynamic localRes;
await BaseAppClient.post(LOGIN_URL, try {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(url,
localRes = response; body: json.encode({
}, onFailure: (String error, int statusCode) { "UserID": userInfo.UserID,
throw error; "Password": userInfo.Password,
}, body: { "ProjectID": userInfo.ProjectID,
"UserID": userInfo.UserID, "LanguageID": userInfo.LanguageID,
"Password": userInfo.Password, "IPAdress": userInfo.IPAdress,
"ProjectID": userInfo.ProjectID, "VersionID": userInfo.VersionID,
"LanguageID": userInfo.LanguageID, "Channel": userInfo.Channel,
"IPAdress": userInfo.IPAdress, "SessionID": userInfo.SessionID
"VersionID": userInfo.VersionID, }));
"Channel": userInfo.Channel, return Future.value(json.decode(response.body));
"SessionID": userInfo.SessionID
});
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<dynamic> insertDeviceImei(imei) async { Future<Map> insertDeviceImei(imei) async {
try { const url = INSERT_DEVICE_IMEI;
dynamic localRes;
await BaseAppClient.post(INSERT_DEVICE_IMEI, try {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(url, body: json.encode(imei));
localRes = response; return Future.value(json.decode(response.body));
}, onFailure: (String error, int statusCode) {
throw error;
}, body: imei);
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<dynamic> selectDeviceImei(imei) async { Future<Map> selectDeviceImei(imei) async {
const url = SELECT_DEVICE_IMEI;
try { try {
dynamic localRes; final response = await AppClient.post(url, body: json.encode(imei));
await BaseAppClient.post(SELECT_DEVICE_IMEI, return Future.value(json.decode(response.body));
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: imei);
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future sendActivationCodeByOtpNotificationType( Future<Map> sendActivationCodeByOtpNotificationType(
activationCodeModel) async { activationCodeModel) async {
const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE;
try { try {
var localRes; final response = await AppClient.post(url, body: json.encode(activationCodeModel));
await BaseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, return Future.value(json.decode(response.body));
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: activationCodeModel);
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<dynamic> memberCheckActivationCodeNew(activationCodeModel) async { Future<Map> memberCheckActivationCodeNew(activationCodeModel) async {
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
try { try {
dynamic localRes; final response = await AppClient.post(url, body: json.encode(activationCodeModel));
await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, return Future.value(json.decode(response.body));
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: activationCodeModel);
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
@ -116,16 +94,12 @@ class AuthProvider with ChangeNotifier {
*@return:Future<Map> *@return:Future<Map>
*@desc: getDocProfiles *@desc: getDocProfiles
*/ */
Future<dynamic> getDocProfiles(docInfo) async { Future<Map> getDocProfiles(docInfo) async {
const url = GET_DOC_PROFILES;
try { try {
dynamic localRes; final response = await AppClient.post(url, body: json.encode(docInfo));
await BaseAppClient.post(GET_DOC_PROFILES, return Future.value(json.decode(response.body));
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: docInfo);
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;

@ -1,8 +1,11 @@
import 'package:doctor_app_flutter/client/base_app_client.dart'; 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/config/config.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class HospitalProvider with ChangeNotifier { class HospitalProvider with ChangeNotifier {
Future<Map> getProjectsList() async { Future<Map> getProjectsList() async {
const url = GET_PROJECTS; const url = GET_PROJECTS;
var info = { var info = {
@ -15,17 +18,12 @@ class HospitalProvider with ChangeNotifier {
"SessionID": "i1UJwCTSqt", "SessionID": "i1UJwCTSqt",
"IsLoginForDoctorApp": true "IsLoginForDoctorApp": true
}; };
dynamic localRes ; try {
final response = await AppClient.post(url, body: json.encode(info));
await BaseAppClient.post(url, return Future.value(json.decode(response.body));
onSuccess: ( response, statusCode) async { } catch (error) {
localRes= response; throw error;
}, // print('error');
onFailure: (String error, int statusCode) { }
throw error;
},
body: info);
return Future.value(localRes);
} }
} }

@ -1,39 +1,57 @@
import 'package:doctor_app_flutter/client/base_app_client.dart'; 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/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart'; import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart';
import 'package:doctor_app_flutter/models/pharmacies_items_request_model.dart'; import 'package:doctor_app_flutter/models/pharmacies_items_request_model.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '.../../../util/dr_app_shared_pref.dart';
class MedicineProvider with ChangeNotifier { class MedicineProvider with ChangeNotifier {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
var pharmacyItemsList = []; var pharmacyItemsList = [];
var pharmaciesList = []; var pharmaciesList = [];
bool isFinished = true; bool isFinished = true;
bool hasError = false; bool hasError = false;
String errorMsg = ''; String errorMsg = '';
PharmaciesItemsRequestModel _itemsRequestModel = PharmaciesItemsRequestModel _itemsRequestModel =PharmaciesItemsRequestModel();
PharmaciesItemsRequestModel();
PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel();
Future<String> getMedicineItem(String itemName) async { Future<String> getMedicineItem(String itemName) async {
resetDefaultValues(); resetDefaultValues();
try { try {
_itemsRequestModel.pHRItemName = itemName; if (await Helpers.checkConnection()) {
await BaseAppClient.post(PHARMACY_ITEMS_URL, _itemsRequestModel.pHRItemName = itemName;
onSuccess: (dynamic response, int statusCode) {
pharmacyItemsList = response['ListPharmcy_Region']; final response = await AppClient.post(PHARMACY_ITEMS_URL,
hasError = false; body: json.encode(_itemsRequestModel.toJson()));
final int statusCode = response.statusCode;
isFinished = true; isFinished = true;
errorMsg = "Done"; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isFinished = true;
hasError = true;
errorMsg = 'Error While Fetching data';
} else {
var parsed = json.decode(response.body.toString());
if (parsed['MessageStatus'] == 1) {
pharmacyItemsList = parsed['ListPharmcy_Region'];
hasError = false;
isFinished = true;
errorMsg = "Done";
} else {
hasError = true;
errorMsg = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage'];
}
}
} else {
isFinished = true; isFinished = true;
hasError = true; hasError = true;
errorMsg = error; errorMsg = 'Please Check The Internet Connection';
}, body: _itemsRequestModel.toJson()); }
notifyListeners(); notifyListeners();
} catch (error) { } catch (error) {
throw error; throw error;
@ -43,20 +61,37 @@ class MedicineProvider with ChangeNotifier {
} }
Future<String> getPharmaciesList(int itemId) async { Future<String> getPharmaciesList(int itemId) async {
String token = await sharedPref.getString(TOKEN);
resetDefaultValues(); resetDefaultValues();
try { try {
_listRequestModel.itemID = itemId; if (await Helpers.checkConnection()) {
await BaseAppClient.post(PHARMACY_LIST_URL, _listRequestModel.itemID = itemId;
onSuccess: (dynamic response, int statusCode) { _listRequestModel.tokenID = token;
pharmaciesList = response['PharmList']; final response = await AppClient.post(PHARMACY_LIST_URL,
hasError = false; body: json.encode(_listRequestModel.toJson()));
final int statusCode = response.statusCode;
isFinished = true; isFinished = true;
errorMsg = "Done"; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isFinished = true;
hasError = true;
errorMsg = 'Error While Fetching data';
} else {
var parsed = json.decode(response.body.toString());
if (parsed['MessageStatus'] == 1) {
pharmaciesList = parsed['PharmList'];
hasError = false;
isFinished = true;
errorMsg = "Done";
} else {
hasError = true;
errorMsg = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage'];
}
}
} else {
isFinished = true; isFinished = true;
hasError = true; hasError = true;
errorMsg = error; errorMsg = 'Please Check The Internet Connection';
}, body: _listRequestModel.toJson()); }
notifyListeners(); notifyListeners();
} catch (error) { } catch (error) {
throw error; throw error;

@ -1,3 +1,6 @@
import 'dart:convert';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor_profile_model.dart';
@ -15,8 +18,12 @@ import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart';
import 'package:doctor_app_flutter/models/prescription_report.dart'; import 'package:doctor_app_flutter/models/prescription_report.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:http/http.dart';
import 'package:http_interceptor/http_client_with_interceptor.dart';
import '../client/app_client.dart';
import '../config/config.dart'; import '../config/config.dart';
import '../interceptor/http_interceptor.dart';
import '../models/patient/lab_orders_res_model.dart'; import '../models/patient/lab_orders_res_model.dart';
import '../models/patient/patiant_info_model.dart'; import '../models/patient/patiant_info_model.dart';
import '../models/patient/patient_model.dart'; import '../models/patient/patient_model.dart';
@ -60,47 +67,53 @@ class PatientsProvider with ChangeNotifier {
STPReferralFrequencyRequest(); STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest(); ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest(); ReferToDoctorRequest _referToDoctorRequest ;
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
PatiantInformtion _selectedPatient; PatiantInformtion _selectedPatient;
Future<dynamic> getPatientList(PatientModel patient, patientType) async { Future<Map> getPatientList(PatientModel patient, patientType) async {
/* const url =
BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/
int val = int.parse(patientType); int val = int.parse(patientType);
//**********Modify url by amjad amireh for patiant type*********
try { final url =
dynamic localRes; BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val];
await BaseAppClient.post('DoctorApplication.svc/REST/' + SERVICES_PATIANT[val], // print("a===========$url=======a");
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {
"ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID,
"DoctorID": patient.DoctorID,
"FirstName": patient.FirstName,
"MiddleName": patient.MiddleName,
"LastName": patient.LastName,
"PatientMobileNumber": patient.PatientMobileNumber,
"PatientIdentificationID": patient.PatientIdentificationID,
"PatientID": patient.PatientID,
"From": patient.From,
"To": patient.To,
"LanguageID": patient.LanguageID,
"stamp": patient.stamp,
"IPAdress": patient.IPAdress,
"VersionID": patient.VersionID,
"Channel": patient.Channel,
"TokenID": patient.TokenID,
"SessionID": patient.SessionID,
"IsLoginForDoctorApp": patient.IsLoginForDoctorApp,
"PatientOutSA": patient.PatientOutSA
});
return Future.value(localRes); try {
} catch (error) { final response = await client.post(url,
print(error); body: json.encode({
throw error; "ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID,
"DoctorID": patient.DoctorID,
"FirstName": patient.FirstName,
"MiddleName": patient.MiddleName,
"LastName": patient.LastName,
"PatientMobileNumber": patient.PatientMobileNumber,
"PatientIdentificationID": patient.PatientIdentificationID,
"PatientID": patient.PatientID,
"From": patient.From,
"To": patient.To,
"LanguageID": patient.LanguageID,
"stamp": patient.stamp,
"IPAdress": patient.IPAdress,
"VersionID": patient.VersionID,
"Channel": patient.Channel,
"TokenID": patient.TokenID,
"SessionID": patient.SessionID,
"IsLoginForDoctorApp": patient.IsLoginForDoctorApp,
"PatientOutSA": patient.PatientOutSA
}));
//**********************
//***********************
return Future.value(json.decode(response.body));
} catch (err) {
throw err;
} }
} }
@ -122,38 +135,48 @@ class PatientsProvider with ChangeNotifier {
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(GET_PATIENT_VITAL_SIGN, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(GET_PATIENT_VITAL_SIGN,
patientVitalSignList = []; body: json.encode(patient));
response['List_DoctorPatientVitalSign'].forEach((v) { final int statusCode = response.statusCode;
patientVitalSignList.add(new VitalSignResModel.fromJson(v)); isLoading = false;
});
if (patientVitalSignList.length > 0) { if (statusCode < 200 || statusCode >= 400 || json == null) {
List<VitalSignResModel> patientVitalSignOrderdSubListTemp = []; isError = true;
patientVitalSignOrderdSubListTemp = patientVitalSignList; error = 'Error While Fetching data';
patientVitalSignOrderdSubListTemp } else {
.sort((VitalSignResModel a, VitalSignResModel b) { var res = json.decode(response.body);
return b.vitalSignDate.microsecondsSinceEpoch - print('$res');
a.vitalSignDate.microsecondsSinceEpoch; if (res['MessageStatus'] == 1) {
}); patientVitalSignList = [];
patientVitalSignOrderdSubList.clear(); res['List_DoctorPatientVitalSign'].forEach((v) {
int length = patientVitalSignOrderdSubListTemp.length >= 20 patientVitalSignList.add(new VitalSignResModel.fromJson(v));
? 20 });
: patientVitalSignOrderdSubListTemp.length;
for (int x = 0; x < length; x++) { if (patientVitalSignList.length > 0) {
patientVitalSignOrderdSubList List<VitalSignResModel> patientVitalSignOrderdSubListTemp = [];
.add(patientVitalSignOrderdSubListTemp[x]); patientVitalSignOrderdSubListTemp = patientVitalSignList;
patientVitalSignOrderdSubListTemp
.sort((VitalSignResModel a, VitalSignResModel b) {
return b.vitalSignDate.microsecondsSinceEpoch -
a.vitalSignDate.microsecondsSinceEpoch;
});
patientVitalSignOrderdSubList.clear();
for (int x = 0; x < 20; x++) {
patientVitalSignOrderdSubList
.add(patientVitalSignOrderdSubListTemp[x]);
}
}
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
} }
} }
isLoading = false; } else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -172,20 +195,33 @@ class PatientsProvider with ChangeNotifier {
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(GET_PATIENT_LAB_OREDERS, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(GET_PATIENT_LAB_OREDERS,
patientLabResultOrdersList = []; body: json.encode(patient));
response['List_GetLabOreders'].forEach((v) { final int statusCode = response.statusCode;
patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v));
});
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
patientLabResultOrdersList = [];
res['List_GetLabOreders'].forEach((v) {
patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v));
});
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -200,21 +236,36 @@ class PatientsProvider with ChangeNotifier {
*/ */
getOutPatientPrescriptions(patient) async { getOutPatientPrescriptions(patient) async {
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(GET_PRESCRIPTION, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response =
patientPrescriptionsList = []; await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient));
response['PatientPrescriptionList'].forEach((v) { final int statusCode = response.statusCode;
patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v));
});
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
patientPrescriptionsList = [];
res['PatientPrescriptionList'].forEach((v) {
patientPrescriptionsList
.add(new PrescriptionResModel.fromJson(v));
});
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -298,20 +349,33 @@ class PatientsProvider with ChangeNotifier {
// notifyListeners(); // notifyListeners();
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(GET_RADIOLOGY, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response =
patientRadiologyList = []; await AppClient.post(GET_RADIOLOGY, body: json.encode(patient));
response['List_GetRadOreders'].forEach((v) { final int statusCode = response.statusCode;
patientRadiologyList.add(new RadiologyResModel.fromJson(v));
});
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
patientRadiologyList = [];
res['List_GetRadOreders'].forEach((v) {
patientRadiologyList.add(new RadiologyResModel.fromJson(v));
});
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -345,17 +409,31 @@ class PatientsProvider with ChangeNotifier {
getPatientInsuranceApprovals(patient) async { getPatientInsuranceApprovals(patient) async {
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL,
insuranceApporvalsList = response['List_ApprovalMain_InPatient']; body: json.encode(patient));
final int statusCode = response.statusCode;
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
//patientRadiologyList = [];
insuranceApporvalsList = res['List_ApprovalMain_InPatient'];
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -369,17 +447,30 @@ class PatientsProvider with ChangeNotifier {
getPatientProgressNote(patient) async { getPatientProgressNote(patient) async {
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { final response = await AppClient.post(PATIENT_PROGRESS_NOTE_URL,
patientProgressNoteList = response['List_GetPregressNoteForInPatient']; body: json.encode(patient));
final int statusCode = response.statusCode;
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
patientProgressNoteList = res['List_GetPregressNoteForInPatient'];
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: patient); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -391,23 +482,45 @@ class PatientsProvider with ChangeNotifier {
*@desc: getDoctorsList *@desc: getDoctorsList
*/ */
getDoctorsList(String clinicId) async { getDoctorsList(String clinicId) async {
String token = await sharedPref.getString(TOKEN);
int projectID = await sharedPref.getInt(PROJECT_ID);
setBasicData(); setBasicData();
try { try {
_doctorsByClinicIdRequest.clinicID = clinicId; if (await Helpers.checkConnection()) {
await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, _doctorsByClinicIdRequest.projectID = projectID;
onSuccess: (dynamic response, int statusCode) { _doctorsByClinicIdRequest.clinicID = clinicId;
doctorsList = response['List_Doctors_All']; _doctorsByClinicIdRequest.tokenID = token;
isLoading = false;
isError = false; final response = await AppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL,
this.error = ''; body: json.encode(_doctorsByClinicIdRequest));
}, onFailure: (String error, int statusCode) { final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400 || json == null) {
isError = true;
error = 'Error While Fetching data';
isLoading = false;
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
doctorsList = res['List_Doctors_All'];
isLoading = false;
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
isLoading = false;
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: _doctorsByClinicIdRequest.toJson()); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
isLoading = false;
} }
} }
@ -422,19 +535,37 @@ class PatientsProvider with ChangeNotifier {
*@desc: getClinicsList *@desc: getClinicsList
*/ */
getClinicsList() async { getClinicsList() async {
String token = await sharedPref.getString(TOKEN);
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { int projectID = await sharedPref.getInt(PROJECT_ID);
clinicsList = response['List_Clinic_All']; _clinicByProjectIdRequest.projectID = projectID;
_clinicByProjectIdRequest.tokenID = token;
final response = await AppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
body: json.encode(_clinicByProjectIdRequest));
final int statusCode = response.statusCode;
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
clinicsList = res['List_Clinic_All'];
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: _clinicByProjectIdRequest.toJson()); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -453,19 +584,33 @@ class PatientsProvider with ChangeNotifier {
*@desc: getReferralFrequancyList *@desc: getReferralFrequancyList
*/ */
getReferralFrequancyList() async { getReferralFrequancyList() async {
String token = await sharedPref.getString(TOKEN);
setBasicData(); setBasicData();
try { try {
await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL, if (await Helpers.checkConnection()) {
onSuccess: (dynamic response, int statusCode) { _referralFrequencyRequest.tokenID = token;
referalFrequancyList = response['list_STPReferralFrequency']; final response = await AppClient.post(PATIENT_GET_LIST_REFERAL_URL,
body: json.encode(_referralFrequencyRequest));
final int statusCode = response.statusCode;
isLoading = false; isLoading = false;
isError = false; if (statusCode < 200 || statusCode >= 400 || json == null) {
this.error = ''; isError = true;
}, onFailure: (String error, int statusCode) { error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
referalFrequancyList = res['list_STPReferralFrequency'];
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: _referralFrequencyRequest.toJson()); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -483,48 +628,69 @@ class PatientsProvider with ChangeNotifier {
*@Date:3/6/2020 *@Date:3/6/2020
*@desc: referToDoctor *@desc: referToDoctor
*/ */
referToDoctor( referToDoctor(context,
int selectedDoctorID, {String selectedDoctorID,
int selectedClinicID, String selectedClinicID,
String selectedReferralFrequancyID,
int admissionNo, int admissionNo,
String extension, String extension,
String doctorRemark) async { String priority,
String token = await sharedPref.getString(TOKEN); String frequency,
int projectID = await sharedPref.getInt(PROJECT_ID); String referringDoctorRemarks,
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); int patientID,
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); int patientTypeID,
int doctorID = doctorProfile.doctorID; String roomID,
int clinicId = doctorProfile.clinicID; int projectID}) async {
setBasicData(); setBasicData();
try { try {
// _referToDoctorRequest.tokenID = token; if (await Helpers.checkConnection()) {
// _referToDoctorRequest.admissionNo = admissionNo; String token = await sharedPref.getString(TOKEN);
// _referToDoctorRequest.projectID = projectID; Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
// _referToDoctorRequest.tokenID = token; DoctorProfileModel doctorProfile =
// _referToDoctorRequest.extension = extension; new DoctorProfileModel.fromJson(profile);
// _referToDoctorRequest.frequency = selectedReferralFrequancyID; int doctorID = doctorProfile.doctorID;
// _referToDoctorRequest.patientID = int clinicId = doctorProfile.clinicID;
// _referToDoctorRequest.priority = _referToDoctorRequest = ReferToDoctorRequest(
// _referToDoctorRequest.referralClinic = projectID: projectID,
// _referToDoctorRequest.referralDoctor = admissionNo: admissionNo,
// _referToDoctorRequest.referringDoctorRemarks = roomID: roomID,
// _referToDoctorRequest.roomID = referralClinic: selectedClinicID.toString(),
// _referToDoctorRequest.referringClinic = referralDoctor: selectedDoctorID.toString(),
// _referToDoctorRequest.referringDoctor = createdBy: doctorID,
editedBy: doctorID,
await BaseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL, patientID: patientID,
onSuccess: (dynamic response, int statusCode) { patientTypeID: patientTypeID,
patientProgressNoteList = response['List_GetPregressNoteForInPatient']; referringClinic: clinicId,
referringDoctor: doctorID,
referringDoctorRemarks: referringDoctorRemarks,
priority: priority,
frequency: frequency,
extension: extension,
tokenID: token);
final response = await AppClient.post(PATIENT_REFER_TO_DOCTOR_URL,
body: json.encode(_referToDoctorRequest));
final int statusCode = response.statusCode;
isLoading = false; isLoading = false;
isError = false;
this.error = ''; if (statusCode < 200 || statusCode >= 400 || json == null) {
}, onFailure: (String error, int statusCode) { isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
print('Done : \n $res');
Navigator.pop(context);
} else {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false; isLoading = false;
isError = true; isError = true;
this.error = error; error = 'Please Check The Internet Connection';
}, body: _referralFrequencyRequest.toJson()); }
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);

@ -7,7 +7,6 @@ import 'package:doctor_app_flutter/models/patient/patient_model.dart';
import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.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_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.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';
@ -160,9 +159,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
} else { } else {
setState(() { setState(() {
isError = true; isError = true;
error = 'No patient';
isLoading = false; isLoading = false;
}); });
DrAppToastMsg.showErrorToast('No patient');
} }
break; break;
case "1": case "1":
@ -177,27 +176,20 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
}); });
} else { } else {
setState(() { setState(() {
error = 'No patient';
isError = true; isError = true;
isLoading = false; isLoading = false;
}); });
DrAppToastMsg.showErrorToast('No patient');
break; break;
} }
} }
} else { } else {
setState(() { setState(() {
error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ;
isLoading = false; isLoading = false;
isError = true; isError = true;
}); });
DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
} }
}).catchError((error){
setState(() {
isLoading = false;
});
helpers.showErrorToast(error);
//DrAppToastMsg.showErrorToast(error);
}); });
} }
// } // }

@ -11,7 +11,6 @@ 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_text_form_field.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/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../util/extenstions.dart'; import '../../util/extenstions.dart';
@ -61,9 +60,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
hintText: 'Search Medicine Name Here..', hintText: 'Search Medicine Name Here..',
controller: myController, controller: myController,
onSaved: (value) {}, onSaved: (value) {},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS), inputFormatter: ONLY_LETTERS),
), ),
@ -99,7 +95,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
), ),
Expanded( Expanded(
child: Container( child: Container(
width: SizeConfig.screenWidth * 0.80, width: SizeConfig.screenWidth * 0.97,
child: !_medicineProvider.isFinished child: !_medicineProvider.isFinished
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: _medicineProvider.hasError : _medicineProvider.hasError
@ -127,7 +123,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
builder: (context) => ChangeNotifierProvider( builder: (context) => ChangeNotifierProvider(
create: (_) => MedicineProvider(), create: (_) => MedicineProvider(),
child: PharmaciesListScreen( child: PharmaciesListScreen(
itemID: data[index]["ItemID"]), itemID: data[index]["ItemID"], url: data[index]["ProductImageBase64"]),
), ),
), ),
); );

@ -1,11 +1,10 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'dart:convert';
import 'dart:typed_data';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart';
import 'package:doctor_app_flutter/providers/medicine_provider.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_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/widgets/medicine/medicine_item_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';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
@ -20,8 +19,11 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class PharmaciesListScreen extends StatefulWidget { class PharmaciesListScreen extends StatefulWidget {
final int itemID; final int itemID;
final String url;
// In the constructor, require a item id. // In the constructor, require a item id.
PharmaciesListScreen({Key key, @required this.itemID}) : super(key: key); PharmaciesListScreen({Key key, @required this.itemID, this.url})
: super(key: key);
@override @override
_PharmaciesListState createState() => _PharmaciesListState(); _PharmaciesListState createState() => _PharmaciesListState();
@ -61,44 +63,77 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
TextStyle(color: Theme.of(context).errorColor), TextStyle(color: Theme.of(context).errorColor),
), ),
) )
: Column( : StreamBuilder<Object>(
mainAxisAlignment: MainAxisAlignment.start, stream: null,
crossAxisAlignment: CrossAxisAlignment.stretch, builder: (context, snapshot) {
children: <Widget>[ return Row(
AppText( children: <Widget>[
"Description", Expanded(
margin: 10, flex: 1,
fontWeight: FontWeight.bold, child: ClipRRect(
), borderRadius:
AppText( BorderRadius.all(Radius.circular(7)),
_data[0]["ItemDescription"], child: Image.memory(
marginLeft: 10, dataFromBase64String(widget.url),
marginTop: 0, height: SizeConfig.imageSizeMultiplier * 21,
marginRight: 10, width: SizeConfig.imageSizeMultiplier * 20,
marginBottom: 10, fit: BoxFit.cover,
), ),
AppText( ),
"Price", ),
margin: 10, Expanded(
fontWeight: FontWeight.bold, flex: 3,
), child: Column(
AppText( mainAxisAlignment: MainAxisAlignment.start,
_data[0]["SellingPrice"].toString(), crossAxisAlignment:
marginLeft: 10, CrossAxisAlignment.stretch,
marginTop: 0, children: <Widget>[
marginRight: 10, AppText(
marginBottom: 10, "Description",
), marginLeft: 10,
], marginTop: 0,
)), marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
_data[0]["ItemDescription"],
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
AppText(
"Price",
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
_data[0]["SellingPrice"].toString(),
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
],
),
)
],
);
})),
Container( Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.only(top:SizeConfig.widthMultiplier * 2,
bottom: SizeConfig.widthMultiplier * 2,
right: SizeConfig.widthMultiplier * 4,
left: SizeConfig.widthMultiplier * 4,),
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: AppText( child: AppText(
"You can Find it in", "You can Find it in",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 3,
))), ))),
Expanded( Expanded(
child: Container( child: Container(
@ -114,7 +149,8 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Expanded( Expanded(
flex: 1, flex: 1,
child: ClipRRect( child: ClipRRect(
borderRadius:BorderRadius.all(Radius.circular(7)), borderRadius:
BorderRadius.all(Radius.circular(7)),
child: Image.network( child: Image.network(
_data[index]["ProjectImageURL"], _data[index]["ProjectImageURL"],
height: SizeConfig.imageSizeMultiplier * 15, height: SizeConfig.imageSizeMultiplier * 15,
@ -138,25 +174,36 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
crossAxisAlignment: WrapCrossAlignment.end, crossAxisAlignment: WrapCrossAlignment.end,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: InkWell(child: Icon(Icons.call, color: Colors.red,),onTap: ()=>launch( child: InkWell(
"tel://" + _data[index]["PhoneNumber"]),), child: Icon(
), Icons.call,
Padding( color: Colors.red,
padding: EdgeInsets.all(5), ),
child: InkWell(child: Icon(Icons.pin_drop, color: Colors.red,),onTap: () { onTap: () => launch(
MapsLauncher.launchCoordinates( "tel://" + _data[index]["PhoneNumber"]),
double.parse(_data[index]["Latitude"]), ),
double.parse(_data[index]["Longitude"]), ),
_data[index]["LocationDescription"]); Padding(
},), padding: EdgeInsets.all(5),
), child: InkWell(
child: Icon(
Icons.pin_drop,
color: Colors.red,
),
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
_data[index]["Latitude"]),
double.parse(
_data[index]["Longitude"]),
_data[index]["LocationDescription"]);
},
),
),
], ],
), ),
), ),
], ],
), ),
); );
@ -170,9 +217,20 @@ Padding(
_medicineProvider.getPharmaciesList(widget.itemID).then((result) { _medicineProvider.getPharmaciesList(widget.itemID).then((result) {
this.setState(() { this.setState(() {
_data = _medicineProvider.pharmaciesList; _data = _medicineProvider.pharmaciesList;
//if(_data == null || _data.length == 0)
}); });
}); });
return true; return true;
} }
Image imageFromBase64String(String base64String) {
return Image.memory(base64Decode(base64String));
}
Uint8List dataFromBase64String(String base64String) {
return base64Decode(base64String);
}
String base64String(Uint8List data) {
return base64Encode(data);
}
} }

@ -33,10 +33,6 @@ class _PatientsListScreenState extends State<PatientsListScreen> {
print(res); print(res);
}).catchError((error) { }).catchError((error) {
print(error); print(error);
setState(() {
_isLoading = false;
_hasError = error;
});
}); });
} }
_isInit = false; _isInit = false;

@ -104,8 +104,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
}).catchError((error) { }).catchError((error) {
setState(() { setState(() {
_isError = true; _isError = true;
_isLoading = false; this.error = helpers.generateContactAdminMsg(error);
this.error = error;
}); });
}); });
} }

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/patient/insurance_aprovals_request.dart'; import 'package:doctor_app_flutter/models/patient/insurance_aprovals_request.dart';
import 'package:doctor_app_flutter/presentation/doctor_app_icons.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -116,29 +117,46 @@ class _InsuranceApprovalsState extends State<InsuranceApprovalsScreen> {
ExpansionTile( ExpansionTile(
title: Row( title: Row(
children: <Widget>[ children: <Widget>[
Icon( Column(
approvalsList[index][ children: <Widget>[
"ApprovalStatusDescption"] Icon(
.toString() approvalsList[index][
.contains("Approved")
? Icons.check_circle_outline
: approvalsList[index][
"ApprovalStatusDescption"] "ApprovalStatusDescption"]
.toString() .toString()
.contains("Cancelled") .contains("Approved")
? Icons.highlight_off ? DoctorApp.approved_icon
: Icons.history, : approvalsList[index][
color: approvalsList[index][ "ApprovalStatusDescption"]
"ApprovalStatusDescption"] .toString()
.toString() .contains("Cancelled")
.contains("Approved") ? DoctorApp.reject_icon
? Colors.green : DoctorApp.pending_icon,
: approvalsList[index][ color: approvalsList[index][
"ApprovalStatusDescption"] "ApprovalStatusDescption"]
.toString() .toString()
.contains("Cancelled") .contains("Approved")
? Colors.red ? Colors.green
: Colors.yellow, : approvalsList[index][
"ApprovalStatusDescption"]
.toString()
.contains("Cancelled")
? Colors.red
: Colors.yellow,
),
AppText(approvalsList[index]["ApprovalStatusDescption"],
fontSize: SizeConfig.textMultiplier * 1.5,
color: approvalsList[index][
"ApprovalStatusDescption"]
.toString()
.contains("Approved")
? Colors.green
: approvalsList[index][
"ApprovalStatusDescption"]
.toString()
.contains("Cancelled")
? Colors.red
: Colors.yellow,)
],
), ),
Expanded( Expanded(
child: Column( child: Column(
@ -186,15 +204,8 @@ class _InsuranceApprovalsState extends State<InsuranceApprovalsScreen> {
backgroundColor: backgroundColor:
Color(PRIMARY_COLOR), Color(PRIMARY_COLOR),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row(
children: <Widget>[
AppText(
"Approval No:",
color: Colors.white,
fontSize: 16,
margin: 10,
),
AppText( AppText(
approvalsList[index] approvalsList[index]
["ApprovalNo"] ["ApprovalNo"]
@ -203,10 +214,21 @@ class _InsuranceApprovalsState extends State<InsuranceApprovalsScreen> {
fontSize: 19, fontSize: 19,
fontWeight: fontWeight:
FontWeight.bold, FontWeight.bold,
margin: 5, marginTop: 10,
marginLeft: 10,
marginRight: 10,
marginBottom: 2,
),
AppText(
"Approval No:",
color: Colors.white,
fontSize: 16,
marginTop: 2,
marginLeft: 10,
marginBottom: 15,
marginRight: 10,
), ),
],
),
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(

@ -132,6 +132,10 @@ class _RadiologyScreenState extends State<RadiologyScreen> {
url: patientsProv url: patientsProv
.patientRadiologyList[index] .patientRadiologyList[index]
.doctorImageURL, .doctorImageURL,
name: patientsProv
.patientLabResultOrdersList[
index]
.doctorName,
), ),
Expanded( Expanded(
child: Padding( child: Padding(

@ -1,6 +1,13 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../config/size_config.dart'; import '../../../config/size_config.dart';
import '../../../providers/patients_provider.dart'; import '../../../providers/patients_provider.dart';
@ -27,26 +34,29 @@ class ReferPatientScreen extends StatefulWidget {
class _ReferPatientState extends State<ReferPatientScreen> { class _ReferPatientState extends State<ReferPatientScreen> {
PatientsProvider patientsProv; PatientsProvider patientsProv;
var doctorsList; var doctorsList;
var clinicsList; final _remarksController = TextEditingController();
var referralFrequancyList; final _extController = TextEditingController();
final _controller = TextEditingController();
var _isInit = true; var _isInit = true;
var clinicId;
var doctorId;
var freqId;
String _selectedClinic; String _selectedClinic;
String _selectedDoctor; String _selectedDoctor;
String _selectedReferralFrequancy; String _selectedReferralFrequancy;
List<String> _priorities = ['Very Urgent', 'Urgent', 'Routine'];
int _activePriority = 2;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
doctorsList = null;
patientsProv = Provider.of<PatientsProvider>(context); patientsProv = Provider.of<PatientsProvider>(context);
patientsProv.getClinicsList(); patientsProv.getClinicsList();
patientsProv.getReferralFrequancyList(); patientsProv.getReferralFrequancyList();
setState(() {
clinicsList = patientsProv.clinicsList;
referralFrequancyList = patientsProv.referalFrequancyList;
});
} }
_isInit = false; _isInit = false;
} }
@ -54,214 +64,413 @@ class _ReferPatientState extends State<ReferPatientScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: "Progress Note", appBarTitle: "Refer Patient",
body: patientsProv.isLoading body: patientsProv.isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: patientsProv.isError : patientsProv.isError
? DrAppEmbeddedError(error: patientsProv.error) ? DrAppEmbeddedError(error: patientsProv.error)
: clinicsList == null : patientsProv.clinicsList == null
? DrAppEmbeddedError( ? DrAppEmbeddedError(
error: 'You don\'t have any Progress Note') error: 'Something Wrong!')
: Column( : SingleChildScrollView(
children: <Widget>[ child: Column(
RoundedContainer( mainAxisAlignment: MainAxisAlignment.start,
margin: 0, crossAxisAlignment: CrossAxisAlignment.start,
showBorder: true, children: <Widget>[
raduis: 30, AppText(
borderColor: Color(0xff707070), "Clinic",
width: double.infinity, fontSize: 18,
child: Padding( fontWeight: FontWeight.bold,
padding: EdgeInsets.only( marginLeft: 15,
top: SizeConfig.widthMultiplier * 0.9, marginTop: 15,
bottom: SizeConfig.widthMultiplier * 0.9, ),
right: SizeConfig.widthMultiplier * 3, RoundedContainer(
left: SizeConfig.widthMultiplier * 3), margin: 10,
child: Row( showBorder: true,
mainAxisSize: MainAxisSize.max, raduis: 30,
children: <Widget>[ borderColor: Color(0xff707070),
Expanded( width: double.infinity,
// add Expanded to have your dropdown button fill remaining space child: Padding(
child: DropdownButton( padding: EdgeInsets.only(
isExpanded: true, top: SizeConfig.widthMultiplier * 0.9,
value: _selectedClinic, bottom: SizeConfig.widthMultiplier * 0.9,
iconSize: 40, right: SizeConfig.widthMultiplier * 3,
elevation: 16, left: SizeConfig.widthMultiplier * 3),
selectedItemBuilder: child: Row(
(BuildContext context) { mainAxisSize: MainAxisSize.max,
return patientsProv children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child: DropdownButton(
isExpanded: true,
value: _selectedClinic,
iconSize: 40,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return patientsProv
.getClinicNameList()
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item,
fontSize:
SizeConfig.textMultiplier *
2.1,
),
],
);
}).toList();
},
onChanged: (newValue) => {
setState(() {
_selectedDoctor = null;
_selectedClinic = newValue;
var clinicInfo = patientsProv.clinicsList.where((i) =>
i['ClinicDescription']
.toString()
.contains(_selectedClinic)).toList();
clinicId =
clinicInfo[0]['ClinicID'].toString();
patientsProv.getDoctorsList(clinicId);
})
},
items: patientsProv
.getClinicNameList() .getClinicNameList()
.map((item) { .map((item) {
return Row( return DropdownMenuItem(
mainAxisSize: MainAxisSize.max, value: item.toString(),
children: <Widget>[ child: Text(
AppText( item,
item, textAlign: TextAlign.end,
fontSize: ),
SizeConfig.textMultiplier *
2.1,
),
],
); );
}).toList(); }).toList(),
}, ),
onChanged: (newValue) => {
setState(() {
_selectedDoctor = null;
_selectedClinic = newValue;
var clinicInfo =
clinicsList.singleWhere((i) =>
i['ClinicDescription']
.toString()
.contains(_selectedClinic));
var clinicId =
clinicInfo['ClinicID'].toString();
patientsProv.getDoctorsList(clinicId);
})
},
items: patientsProv
.getClinicNameList()
.map((item) {
return DropdownMenuItem(
value: item.toString(),
child: Text(
item,
textAlign: TextAlign.end,
),
);
}).toList(),
), ),
), ],
], ),
), ),
), ),
), //--------------------------------------------------------------------//
//--------------------------------------------------------------------// AppText(
RoundedContainer( "Doctor",
margin: 0, fontSize: 18,
showBorder: true, fontWeight: FontWeight.bold,
raduis: 30, marginLeft: 15,
borderColor: Color(0xff707070), marginTop: 15,
width: double.infinity, ),
child: Padding(
padding: EdgeInsets.only( RoundedContainer(
top: SizeConfig.widthMultiplier * 0.9, margin: 10,
bottom: SizeConfig.widthMultiplier * 0.9, showBorder: true,
right: SizeConfig.widthMultiplier * 3, raduis: 30,
left: SizeConfig.widthMultiplier * 3), borderColor: Color(0xff707070),
child: Row( width: double.infinity,
mainAxisSize: MainAxisSize.max, child: Padding(
children: <Widget>[ padding: EdgeInsets.only(
Expanded( top: SizeConfig.widthMultiplier * 0.9,
// add Expanded to have your dropdown button fill remaining space bottom: SizeConfig.widthMultiplier * 0.9,
child: DropdownButton( right: SizeConfig.widthMultiplier * 3,
isExpanded: true, left: SizeConfig.widthMultiplier * 3),
value: _selectedDoctor, child: Row(
iconSize: 40, mainAxisSize: MainAxisSize.max,
elevation: 16, children: <Widget>[
selectedItemBuilder: Expanded(
(BuildContext context) { // add Expanded to have your dropdown button fill remaining space
return patientsProv child: DropdownButton(
isExpanded: true,
value: _selectedDoctor,
iconSize: 40,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return patientsProv
.getDoctorNameList()
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item,
fontSize:
SizeConfig.textMultiplier *
2.1,
),
],
);
}).toList();
},
onChanged: (newValue) => {
setState(() {
_selectedDoctor = newValue;
doctorsList = patientsProv.doctorsList;
var doctorInfo =
doctorsList.where((i) =>
i['DoctorName']
.toString()
.contains(_selectedDoctor)).toList();
doctorId = doctorInfo[0]['DoctorID'].toString();
})
},
items: patientsProv
.getDoctorNameList() .getDoctorNameList()
.map((item) { .map((item) {
return Row( return DropdownMenuItem(
mainAxisSize: MainAxisSize.max, value: item.toString(),
children: <Widget>[ child: Text(
AppText( item,
item, textAlign: TextAlign.end,
fontSize: ),
SizeConfig.textMultiplier *
2.1,
),
],
); );
}).toList(); }).toList(),
}, ),
onChanged: (newValue) => {
setState(() {
_selectedDoctor = newValue;
})
},
items: patientsProv
.getDoctorNameList()
.map((item) {
return DropdownMenuItem(
value: item.toString(),
child: Text(
item,
textAlign: TextAlign.end,
),
);
}).toList(),
), ),
), ],
], ),
), ),
), //-----------------------------///
AppText(
"Ext#",
fontSize: 18,
fontWeight: FontWeight.bold,
marginLeft: 15,
marginTop: 15,
),
Padding(
padding: const EdgeInsets.all(10.0),
child: AppTextFormField(
hintText: "Ext#",
controller: _extController,
inputFormatter: ONLY_NUMBERS,
textInputType: TextInputType.number,
onChanged: (value) => {},
),
),
AppText(
"Priority",
fontSize: 18,
fontWeight: FontWeight.bold,
marginLeft: 15,
marginTop: 15,
),
priorityBar(context),
AppText(
"Replay Before: " + getPriority(),
fontWeight: FontWeight.bold,
marginLeft: 15,
marginTop: 15,
),
AppText(
"Referral Frequency",
fontSize: 18,
fontWeight: FontWeight.bold,
marginLeft: 15,
marginTop: 15,
), ),
), //-----------------------------/// RoundedContainer(
RoundedContainer( margin: 10,
margin: 0, showBorder: true,
showBorder: true, raduis: 30,
raduis: 30, borderColor: Color(0xff707070),
borderColor: Color(0xff707070), width: double.infinity,
width: double.infinity, child: Padding(
child: Padding( padding: EdgeInsets.only(
padding: EdgeInsets.only( top: SizeConfig.widthMultiplier * 0.9,
top: SizeConfig.widthMultiplier * 0.9, bottom: SizeConfig.widthMultiplier * 0.9,
bottom: SizeConfig.widthMultiplier * 0.9, right: SizeConfig.widthMultiplier * 3,
right: SizeConfig.widthMultiplier * 3, left: SizeConfig.widthMultiplier * 3),
left: SizeConfig.widthMultiplier * 3), child: Row(
child: Row( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, children: <Widget>[
children: <Widget>[ Expanded(
Expanded( // add Expanded to have your dropdown button fill remaining space
// add Expanded to have your dropdown button fill remaining space child: DropdownButton(
child: DropdownButton( isExpanded: true,
isExpanded: true, value: _selectedReferralFrequancy,
value: _selectedReferralFrequancy, iconSize: 40,
iconSize: 40, elevation: 16,
elevation: 16, selectedItemBuilder:
selectedItemBuilder: (BuildContext context) {
(BuildContext context) { return patientsProv
return patientsProv .getReferralNamesList()
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item,
fontSize:
SizeConfig.textMultiplier *
2.1,
),
],
);
}).toList();
},
onChanged: (newValue) => {
setState(() {
_selectedReferralFrequancy = newValue;
var freqInfo =
patientsProv.referalFrequancyList.singleWhere((i) =>
i['Description']
.toString()
.contains(_selectedReferralFrequancy));
freqId =
freqInfo['ParameterCode'].toString();
})
},
items: patientsProv
.getReferralNamesList() .getReferralNamesList()
.map((item) { .map((item) {
return Row( return DropdownMenuItem(
mainAxisSize: MainAxisSize.max, value: item.toString(),
children: <Widget>[ child: Text(
AppText( item,
item, textAlign: TextAlign.end,
fontSize: ),
SizeConfig.textMultiplier *
2.1,
),
],
); );
}).toList(); }).toList(),
}, ),
onChanged: (newValue) => {
setState(() {
_selectedReferralFrequancy = newValue;
})
},
items: patientsProv
.getReferralNamesList()
.map((item) {
return DropdownMenuItem(
value: item.toString(),
child: Text(
item,
textAlign: TextAlign.end,
),
);
}).toList(),
), ),
), ],
], ),
),
),
AppText(
"Clinical Details and Remarks",
fontSize: 18,
fontWeight: FontWeight.bold,
marginLeft: 15,
marginTop: 15,
),
Padding(
padding: const EdgeInsets.all(10.0),
child: AppTextFormField(
hintText: "Remarks",
controller: _remarksController,
inputFormatter: ONLY_LETTERS,
textInputType: TextInputType.text,
onChanged: (value) => {},
), ),
), ),
Padding(
padding: const EdgeInsets.all(20.0),
child: AppButton(title: "Send", color: Color(PRIMARY_COLOR),onPressed: ()=>{
referToDoctor(context)
},),
)
],
),
),
);
}
Widget priorityBar(BuildContext _context) {
return Container(
height: MediaQuery.of(context).size.height * 0.065,
width: SizeConfig.screenWidth * 0.9,
margin: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _priorities.map((item) {
bool _isActive = _priorities[_activePriority] == item ? true : false;
return Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
InkWell(
child: Center(
child: Container(
height: 40,
width: 90,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: _isActive ? Hexcolor("#B8382B") : Colors.white,
),
child: Center(
child: Text(
item,
style: TextStyle(
fontSize: 12,
color: _isActive
? Colors.white
: Colors.black, //Colors.black,
// backgroundColor:_isActive
// ? Hexcolor("#B8382B")
// : Colors.white,//sideColor,
fontWeight: FontWeight.bold,
),
), ),
], )),
), ),
onTap: () {
print(_priorities.indexOf(item));
setState(() {
_activePriority = _priorities.indexOf(item);
});
}),
_isActive
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white),
alignment: Alignment.center,
height: 3,
width: 90,
)
: Container()
]);
}).toList(),
),
); );
} }
String getPriority() {
DateTime date = DateTime.now();
switch (_activePriority) {
case 0:
date = date.add(new Duration(hours: 3));
break;
case 1:
date = date.add(new Duration(hours: 6));
break;
case 2:
date = date.add(new Duration(days: 1));
break;
}
var format = DateFormat('yyyy/mm/dd HH:mm a');
var time = format.format(date);
print(time);
return time;
}
void referToDoctor(context){
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
patientsProv.referToDoctor(context,
extension: _extController.value.text,
admissionNo:int.parse( patient.admissionNo),
referringDoctorRemarks: _remarksController.value.text,
frequency: freqId,
patientID: patient.patientId,
patientTypeID: patient.patientType,
priority: (_activePriority + 1).toString(),
roomID: patient.roomId,
selectedClinicID: clinicId.toString(),
selectedDoctorID: doctorId.toString(),
projectID: patient.projectId
);
}
} }

@ -256,7 +256,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
if (oTPSendType == 1 || oTPSendType == 2) { if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true); widget.changeLoadingStata(true);
Map<String,dynamic> model = { Map model = {
"LogInTokenID": _loggedUser['LogInTokenID'], "LogInTokenID": _loggedUser['LogInTokenID'],
"Channel": 9, "Channel": 9,
"MobileNumber": _loggedUser['MobileNumber'], "MobileNumber": _loggedUser['MobileNumber'],

@ -42,26 +42,24 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
InkWell( Row(
onTap: () { mainAxisAlignment: MainAxisAlignment.spaceBetween,
setState(() { children: <Widget>[
_showDetails = !_showDetails; AppText(
}); '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}',
}, fontSize: 2.5 * SizeConfig.textMultiplier,
child: Row( fontWeight: FontWeight.bold,
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
children: <Widget>[ InkWell(
AppText( onTap: () {
'${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', setState(() {
fontSize: 2.5 * SizeConfig.textMultiplier, _showDetails = !_showDetails;
fontWeight: FontWeight.bold, });
), },
Icon(_showDetails child: Icon(_showDetails
? Icons.keyboard_arrow_up ? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down), : Icons.keyboard_arrow_down)),
],
],
),
), ),
!_showDetails !_showDetails
? Container() ? Container()
@ -89,7 +87,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
'${widget.myReferralPatientModel.referringDoctor}', '${widget.myReferralPatientModel.referringDoctor}',
fontSize: fontSize:
@ -111,7 +108,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
widget.myReferralPatientModel widget.myReferralPatientModel
.referringClinicDescription, .referringClinicDescription,
@ -139,7 +135,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
'${widget.myReferralPatientModel.referringClinicDescription}', '${widget.myReferralPatientModel.referringClinicDescription}',
fontSize: fontSize:
@ -162,7 +157,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
widget.myReferralPatientModel widget.myReferralPatientModel
.frequencyDescription, .frequencyDescription,
@ -190,7 +184,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
'${widget.myReferralPatientModel.priorityDescription}', '${widget.myReferralPatientModel.priorityDescription}',
fontSize: fontSize:
@ -213,7 +206,6 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier, 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
SizedBox(height: 5,),
AppText( AppText(
Helpers.getDateFormatted(widget Helpers.getDateFormatted(widget
.myReferralPatientModel .myReferralPatientModel

@ -1,10 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart';
import '../shared/rounded_container_widget.dart'; import '../shared/rounded_container_widget.dart';
import '../shared/app_texts_widget.dart'; import '../shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -35,19 +35,19 @@ class LargeAvatar extends StatelessWidget {
), ),
), ),
); );
} else if (name != null || name.isNotEmpty) { } else if (name == null || name.isEmpty) {
return Center( return Center(
child: AppText( child: AppText(
name[0].toUpperCase(), 'DR',
color: Colors.white, color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
)); ));
} else { } else {
return Center( return Center(
child: AppText( child: AppText(
'DR', name[0].toUpperCase(),
color: Colors.white, color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
)); ));
} }
} }

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../app_texts_widget.dart';
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:12/5/2020 *@Date:12/5/2020
@ -18,10 +20,11 @@ class DrAppEmbeddedError extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Center(
child: Text( child: AppText(
error, error,
style: TextStyle(color: Theme.of(context).errorColor), color: Theme.of(context).errorColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
margin: 10,
), ),
); );
} }

Loading…
Cancel
Save