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/material.dart';
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();
Helpers helpers = new Helpers();
@ -36,6 +38,9 @@ class BaseAppClient {
Function(String error, int statusCode) onFailure,
}) async {
String url = BASE_URL + endPoint;
RequestData data = RequestData(body: body,baseUrl: url,method: Method.POST);
try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN);
@ -44,7 +49,7 @@ class BaseAppClient {
body['DoctorID'] = doctorProfile?.doctorID;
body['EditedBy'] = doctorProfile?.doctorID;
body['ProjectID'] = doctorProfile?.projectID;
if (!body.containsKey('ClinicID'))
// if (!body.containsKey('ClinicID'))
body['ClinicID'] = doctorProfile?.clinicID;
}
body['TokenID'] = token ?? '';
@ -56,6 +61,8 @@ class BaseAppClient {
body['SessionID'] = SESSION_ID;
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP;
body['PatientOutSA'] = PATIENT_OUT_SA;
print("URL : $url");
print("Body : ${json.encode(body)}");
if (await Helpers.checkConnection()) {
final response = await http.post(url,

@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660;
const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z]";
const ONLY_DATE = "[0-9/]";
// const BASE_URL = 'https://hmgwebservices.com/Services/';
const BASE_URL = 'https://uat.hmgwebservices.com/Services/';
const BASE_URL = 'https://hmgwebservices.com/Services/';
//const BASE_URL = 'https://uat.hmgwebservices.com/Services/';
const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region";
const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -23,7 +23,7 @@ const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult';
var selectedPatientType = 0;
//*********change value to decode json from Dropdown ************
//*********change value to decode json from Dropdown ************1
var SERVICES_PATIANT = [
"GetMyOutPatient",
"GetMyInPatient",

@ -62,17 +62,16 @@ class PatientsProvider with ChangeNotifier {
PatiantInformtion _selectedPatient;
getPatientList(PatientModel patient, patientType) async {
Future<dynamic> getPatientList(PatientModel patient, patientType) async {
int val = int.parse(patientType);
try {
var localResponse;
await BaseAppClient.post(
'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val],
onSuccess: (dynamic response, int statusCode) async {
localResponse = response;
}, onFailure: (String error, int statusCode) async {
throw error;
dynamic localRes;
await BaseAppClient.post('DoctorApplication.svc/REST/' + SERVICES_PATIANT[val],
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {
"ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID,
@ -96,9 +95,10 @@ class PatientsProvider with ChangeNotifier {
"PatientOutSA": patient.PatientOutSA
});
return localResponse;
} catch (err) {
handelCatchErrorCase(error);
return Future.value(localRes);
} catch (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/providers/patients_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
@ -159,9 +160,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
} else {
setState(() {
isError = true;
error = 'No patient';
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
}
break;
case "1":
@ -176,20 +177,27 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
});
} else {
setState(() {
error = 'No patient';
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
break;
}
}
} else {
setState(() {
error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ;
isLoading = false;
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
Widget build(BuildContext context) {
scheduleProvider = Provider.of(context);
return Scaffold(
return AppScaffold(
appBarTitle: TranslationBase.of(context).mySchedule,
body: scheduleProvider.isLoading
? DrAppCircularProgressIndeicator()
: scheduleProvider.isError

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

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

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

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

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

Loading…
Cancel
Save