fix issues in get patients service

merge-requests/110/head
Mohammad ALjammal 6 years ago
parent 3e05a58dd7
commit 9b065036ae

@ -9,6 +9,8 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:http_interceptor/http_methods.dart';
import 'package:http_interceptor/models/request_data.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = new Helpers(); Helpers helpers = new Helpers();
@ -36,6 +38,9 @@ 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);
@ -44,7 +49,7 @@ class BaseAppClient {
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
body['EditedBy'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;
body['ProjectID'] = doctorProfile?.projectID; body['ProjectID'] = doctorProfile?.projectID;
if (!body.containsKey('ClinicID')) // if (!body.containsKey('ClinicID'))
body['ClinicID'] = doctorProfile?.clinicID; body['ClinicID'] = doctorProfile?.clinicID;
} }
body['TokenID'] = token ?? ''; body['TokenID'] = token ?? '';
@ -56,6 +61,8 @@ class BaseAppClient {
body['SessionID'] = SESSION_ID; body['SessionID'] = SESSION_ID;
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP;
body['PatientOutSA'] = PATIENT_OUT_SA; body['PatientOutSA'] = PATIENT_OUT_SA;
print("URL : $url");
print("Body : ${json.encode(body)}");
if (await Helpers.checkConnection()) { if (await Helpers.checkConnection()) {
final response = await http.post(url, final response = await http.post(url,

@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660;
const ONLY_NUMBERS = "[0-9]"; const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z]"; const ONLY_LETTERS = "[a-zA-Z]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
// const BASE_URL = 'https://hmgwebservices.com/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";
const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -23,7 +23,7 @@ const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult';
var selectedPatientType = 0; var selectedPatientType = 0;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************1
var SERVICES_PATIANT = [ var SERVICES_PATIANT = [
"GetMyOutPatient", "GetMyOutPatient",
"GetMyInPatient", "GetMyInPatient",

@ -62,17 +62,16 @@ class PatientsProvider with ChangeNotifier {
PatiantInformtion _selectedPatient; PatiantInformtion _selectedPatient;
getPatientList(PatientModel patient, patientType) async { Future<dynamic> getPatientList(PatientModel patient, patientType) async {
int val = int.parse(patientType); int val = int.parse(patientType);
try { try {
var localResponse; dynamic localRes;
await BaseAppClient.post( await BaseAppClient.post('DoctorApplication.svc/REST/' + SERVICES_PATIANT[val],
'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val], onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) async { localRes = response;
localResponse = response; }, onFailure: (String error, int statusCode) {
}, onFailure: (String error, int statusCode) async { throw error;
throw error;
}, body: { }, body: {
"ProjectID": patient.ProjectID, "ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID, "ClinicID": patient.ClinicID,
@ -96,9 +95,10 @@ class PatientsProvider with ChangeNotifier {
"PatientOutSA": patient.PatientOutSA "PatientOutSA": patient.PatientOutSA
}); });
return localResponse; return Future.value(localRes);
} catch (err) { } catch (error) {
handelCatchErrorCase(error); print(error);
throw error;
} }
} }

@ -7,6 +7,7 @@ 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';
@ -159,9 +160,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":
@ -176,20 +177,27 @@ 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);
}); });
} }
// } // }

@ -15,7 +15,8 @@ class MyScheduleScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
scheduleProvider = Provider.of(context); scheduleProvider = Provider.of(context);
return Scaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).mySchedule,
body: scheduleProvider.isLoading body: scheduleProvider.isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: scheduleProvider.isError : scheduleProvider.isError

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

@ -132,10 +132,6 @@ 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(

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

@ -35,25 +35,27 @@ class LargeAvatar extends StatelessWidget {
), ),
), ),
); );
} else if (name == null || name.isEmpty) { } else if (name != null || name.isNotEmpty) {
return Center( return Center(
child: AppText( child: AppText(
'DR', name[0].toUpperCase(),
color: Colors.white, color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
)); ));
} else { } else {
return Center( return Center(
child: AppText( child: AppText(
name[0].toUpperCase(), 'DR',
color: Colors.white, color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
)); ));
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var vlr = name;
var asd;
return InkWell( return InkWell(
onTap: disableProfileView onTap: disableProfileView
? null ? null

Loading…
Cancel
Save