|
|
|
@ -1,6 +1,3 @@
|
|
|
|
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';
|
|
|
|
@ -18,7 +15,6 @@ 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:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../client/app_client.dart';
|
|
|
|
|
|
|
|
import '../config/config.dart';
|
|
|
|
import '../config/config.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';
|
|
|
|
@ -64,8 +60,6 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
ClinicByProjectIdRequest();
|
|
|
|
ClinicByProjectIdRequest();
|
|
|
|
ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest();
|
|
|
|
ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PatiantInformtion _selectedPatient;
|
|
|
|
PatiantInformtion _selectedPatient;
|
|
|
|
|
|
|
|
|
|
|
|
getPatientList(PatientModel patient, patientType) async {
|
|
|
|
getPatientList(PatientModel patient, patientType) async {
|
|
|
|
@ -73,7 +67,8 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var localResponse;
|
|
|
|
var localResponse;
|
|
|
|
await BaseAppClient.post( 'DoctorApplication.svc/REST/'+SERVICES_PATIANT[val],
|
|
|
|
await BaseAppClient.post(
|
|
|
|
|
|
|
|
'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val],
|
|
|
|
onSuccess: (dynamic response, int statusCode) async {
|
|
|
|
onSuccess: (dynamic response, int statusCode) async {
|
|
|
|
localResponse = response;
|
|
|
|
localResponse = response;
|
|
|
|
}, onFailure: (String error, int statusCode) async {
|
|
|
|
}, onFailure: (String error, int statusCode) async {
|
|
|
|
@ -105,7 +100,6 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(error);
|
|
|
|
handelCatchErrorCase(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setBasicData() {
|
|
|
|
setBasicData() {
|
|
|
|
@ -142,7 +136,9 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
a.vitalSignDate.microsecondsSinceEpoch;
|
|
|
|
a.vitalSignDate.microsecondsSinceEpoch;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
patientVitalSignOrderdSubList.clear();
|
|
|
|
patientVitalSignOrderdSubList.clear();
|
|
|
|
int length = patientVitalSignOrderdSubListTemp.length >= 20 ? 20 : patientVitalSignOrderdSubListTemp.length;
|
|
|
|
int length = patientVitalSignOrderdSubListTemp.length >= 20
|
|
|
|
|
|
|
|
? 20
|
|
|
|
|
|
|
|
: patientVitalSignOrderdSubListTemp.length;
|
|
|
|
for (int x = 0; x < length; x++) {
|
|
|
|
for (int x = 0; x < length; x++) {
|
|
|
|
patientVitalSignOrderdSubList
|
|
|
|
patientVitalSignOrderdSubList
|
|
|
|
.add(patientVitalSignOrderdSubListTemp[x]);
|
|
|
|
.add(patientVitalSignOrderdSubListTemp[x]);
|
|
|
|
@ -151,13 +147,11 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -185,13 +179,11 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -211,19 +203,16 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientPrescriptionsList = [];
|
|
|
|
patientPrescriptionsList = [];
|
|
|
|
response['PatientPrescriptionList'].forEach((v) {
|
|
|
|
response['PatientPrescriptionList'].forEach((v) {
|
|
|
|
patientPrescriptionsList
|
|
|
|
patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v));
|
|
|
|
.add(new PrescriptionResModel.fromJson(v));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -307,7 +296,6 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
// notifyListeners();
|
|
|
|
// notifyListeners();
|
|
|
|
setBasicData();
|
|
|
|
setBasicData();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
await BaseAppClient.post(GET_RADIOLOGY,
|
|
|
|
await BaseAppClient.post(GET_RADIOLOGY,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientRadiologyList = [];
|
|
|
|
patientRadiologyList = [];
|
|
|
|
@ -317,13 +305,11 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -363,13 +349,11 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -383,20 +367,17 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
getPatientProgressNote(patient) async {
|
|
|
|
getPatientProgressNote(patient) async {
|
|
|
|
setBasicData();
|
|
|
|
setBasicData();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL,
|
|
|
|
await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
|
|
|
|
patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: patient);
|
|
|
|
body: patient);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -417,13 +398,11 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: _doctorsByClinicIdRequest.toJson());
|
|
|
|
body: _doctorsByClinicIdRequest.toJson());
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -443,20 +422,17 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
getClinicsList() async {
|
|
|
|
getClinicsList() async {
|
|
|
|
setBasicData();
|
|
|
|
setBasicData();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
|
|
|
|
await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
clinicsList = response['List_Clinic_All'];
|
|
|
|
clinicsList = response['List_Clinic_All'];
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: _clinicByProjectIdRequest.toJson());
|
|
|
|
body: _clinicByProjectIdRequest.toJson());
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -477,20 +453,17 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
getReferralFrequancyList() async {
|
|
|
|
getReferralFrequancyList() async {
|
|
|
|
setBasicData();
|
|
|
|
setBasicData();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL,
|
|
|
|
await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
referalFrequancyList = response['list_STPReferralFrequency'];
|
|
|
|
referalFrequancyList = response['list_STPReferralFrequency'];
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = false;
|
|
|
|
isError = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
},
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
this.error = error;
|
|
|
|
this.error = error;
|
|
|
|
},
|
|
|
|
}, body: _referralFrequencyRequest.toJson());
|
|
|
|
body: _referralFrequencyRequest.toJson());
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
@ -523,7 +496,6 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
int clinicId = doctorProfile.clinicID;
|
|
|
|
int clinicId = doctorProfile.clinicID;
|
|
|
|
setBasicData();
|
|
|
|
setBasicData();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (await Helpers.checkConnection()) {
|
|
|
|
|
|
|
|
// _referToDoctorRequest.tokenID = token;
|
|
|
|
// _referToDoctorRequest.tokenID = token;
|
|
|
|
// _referToDoctorRequest.admissionNo = admissionNo;
|
|
|
|
// _referToDoctorRequest.admissionNo = admissionNo;
|
|
|
|
// _referToDoctorRequest.projectID = projectID;
|
|
|
|
// _referToDoctorRequest.projectID = projectID;
|
|
|
|
@ -539,29 +511,18 @@ class PatientsProvider with ChangeNotifier {
|
|
|
|
// _referToDoctorRequest.referringClinic =
|
|
|
|
// _referToDoctorRequest.referringClinic =
|
|
|
|
// _referToDoctorRequest.referringDoctor =
|
|
|
|
// _referToDoctorRequest.referringDoctor =
|
|
|
|
|
|
|
|
|
|
|
|
final response = await AppClient.post(PATIENT_REFER_TO_DOCTOR_URL,
|
|
|
|
await BaseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL,
|
|
|
|
body: json.encode(_referralFrequencyRequest));
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
final int statusCode = response.statusCode;
|
|
|
|
patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
|
|
|
|
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) {
|
|
|
|
|
|
|
|
patientProgressNoteList = res['List_GetPregressNoteForInPatient'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
|
|
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
error = 'Please Check The Internet Connection';
|
|
|
|
this.error = error;
|
|
|
|
}
|
|
|
|
}, body: _referralFrequencyRequest.toJson());
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
handelCatchErrorCase(err);
|
|
|
|
|