Merge branches 'development' and 'special_clinic' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into special_clinic

 Conflicts:
	lib/locator.dart
merge-requests/742/head
Elham Rababah 5 years ago
commit 09634716e5

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -0,0 +1,41 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class ScanQrService extends BaseService {
List<PatiantInformtion> myInPatientList = List();
List<PatiantInformtion> inPatientList = List();
Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {
requestModel.doctorID = 0;
}
await baseAppClient.post(
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {
inPatientList.clear();
myInPatientList.clear();
response['List_MyInPatient'].forEach((v) {
PatiantInformtion patient = PatiantInformtion.fromJson(v);
inPatientList.add(patient);
if (patient.doctorId == doctorProfile.doctorID) {
myInPatientList.add(patient);
}
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: requestModel.toJson(),
);
}
}

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart';
@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequenc
import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
@ -22,20 +24,19 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_mode
class PatientService extends BaseService {
List<VitalSignResModel> _patientVitalSignList = [];
List<VitalSignResModel> patientVitalSignOrderdSubList = [];
List<PatiantInformtion> inPatientList = List();
List<PatiantInformtion> myInPatientList = List();
List<VitalSignResModel> get patientVitalSignList => _patientVitalSignList;
List<LabOrdersResModel> _patientLabResultOrdersList = [];
List<LabOrdersResModel> get patientLabResultOrdersList =>
_patientLabResultOrdersList;
List<LabOrdersResModel> get patientLabResultOrdersList => _patientLabResultOrdersList;
List<PrescriptionResModel> get patientPrescriptionsList =>
_patientPrescriptionsList;
List<PrescriptionResModel> get patientPrescriptionsList => _patientPrescriptionsList;
List<PrescriptionResModel> _patientPrescriptionsList = [];
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList =>
_prescriptionReportForInPatientList;
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList => _prescriptionReportForInPatientList;
List<PrescriptionReportForInPatient> _prescriptionReportForInPatientList = [];
List<RadiologyResModel> _patientRadiologyList = [];
@ -79,12 +80,9 @@ class PatientService extends BaseService {
get referalFrequancyList => _referalFrequancyList;
DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
DoctorsByClinicIdRequest();
STPReferralFrequencyRequest _referralFrequencyRequest =
STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest();
DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest();
STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest;
Future<dynamic> getPatientList(patient, patientType, {isView}) async {
@ -138,6 +136,38 @@ class PatientService extends BaseService {
return Future.value(localRes);
}
Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {
requestModel.doctorID = 0;
}
await baseAppClient.post(
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {
inPatientList.clear();
myInPatientList.clear();
response['List_MyInPatient'].forEach((v) {
PatiantInformtion patient = PatiantInformtion.fromJson(v);
inPatientList.add(patient);
if (patient.doctorId == doctorProfile.doctorID) {
myInPatientList.add(patient);
}
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: requestModel.toJson(),
);
}
Future getLabResultOrders(patient) async {
hasError = false;
await baseAppClient.post(
@ -181,8 +211,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_prescriptionReportForInPatientList = [];
response['List_PrescriptionReportForInPatient'].forEach((v) {
prescriptionReportForInPatientList
.add(PrescriptionReportForInPatient.fromJson(v));
prescriptionReportForInPatientList.add(PrescriptionReportForInPatient.fromJson(v));
});
},
onFailure: (String error, int statusCode) {

@ -2,9 +2,11 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/patient/patient_service.dart';
import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
@ -17,51 +19,43 @@ import 'base_view_model.dart';
class PatientViewModel extends BaseViewModel {
PatientService _patientService = locator<PatientService>();
List<VitalSignResModel> get patientVitalSignList =>
_patientService.patientVitalSignList;
List<PatiantInformtion> get inPatientList => _patientService.inPatientList;
List<VitalSignResModel> get patientVitalSignOrderdSubList =>
_patientService.patientVitalSignOrderdSubList;
List<VitalSignResModel> get patientVitalSignList => _patientService.patientVitalSignList;
List<LabOrdersResModel> get patientLabResultOrdersList =>
_patientService.patientLabResultOrdersList;
List<VitalSignResModel> get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList;
List<PrescriptionResModel> get patientPrescriptionsList =>
_patientService.patientPrescriptionsList;
List<LabOrdersResModel> get patientLabResultOrdersList => _patientService.patientLabResultOrdersList;
List<PrescriptionResModel> get patientPrescriptionsList => _patientService.patientPrescriptionsList;
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList =>
_patientService.prescriptionReportForInPatientList;
List<PrescriptionReport> get prescriptionReport =>
_patientService.prescriptionReport;
List<PrescriptionReport> get prescriptionReport => _patientService.prescriptionReport;
List<RadiologyResModel> get patientRadiologyList =>
_patientService.patientRadiologyList;
List<RadiologyResModel> get patientRadiologyList => _patientService.patientRadiologyList;
List<LabResult> get labResultList => _patientService.labResultList;
get insuranceApporvalsList => _patientService.insuranceApporvalsList;
List<NoteModel> get patientProgressNoteList =>
_patientService.patientProgressNoteList;
List<NoteModel> get patientProgressNoteList => _patientService.patientProgressNoteList;
List<dynamic> get clinicsList => _patientService.clinicsList;
List<dynamic> get doctorsList => _patientService.doctorsList;
List<dynamic> get referralFrequencyList =>
_patientService.referalFrequancyList;
List<dynamic> get referralFrequencyList => _patientService.referalFrequancyList;
Future getPatientList(patient, patientType,
{bool isBusyLocal = false, isView}) async {
Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async {
var localRes;
if (isBusyLocal) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
localRes = await _patientService.getPatientList(patient, patientType,
isView: isView);
localRes = await _patientService.getPatientList(patient, patientType, isView: isView);
if (_patientService.hasError) {
error = _patientService.error;
@ -210,16 +204,12 @@ class PatientViewModel extends BaseViewModel {
}
List getDoctorNameList() {
var doctorNamelist = _patientService.doctorsList
.map((value) => value['DoctorName'].toString())
.toList();
var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList();
return doctorNamelist;
}
List getClinicNameList() {
var clinicsNameslist = _patientService.clinicsList
.map((value) => value['ClinicDescription'].toString())
.toList();
var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList();
return clinicsNameslist;
}
@ -234,9 +224,8 @@ class PatientViewModel extends BaseViewModel {
}
List getReferralNamesList() {
var referralNamesList = _patientService.referalFrequancyList
.map((value) => value['Description'].toString())
.toList();
var referralNamesList =
_patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList();
return referralNamesList;
}
@ -281,4 +270,18 @@ class PatientViewModel extends BaseViewModel {
} else
setState(ViewState.Idle);
}
Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
await _patientService.getInPatient(requestModel, false);
if (_patientService.hasError) {
error = _patientService.error;
setState(ViewState.ErrorLocal);
} else {
// setDefaultInPatientList();
setState(ViewState.Idle);
}
}
}

@ -0,0 +1,26 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class ScanQrViewModel extends BaseViewModel {
ScanQrService _scanQrService = locator<ScanQrService>();
List<PatiantInformtion> get inPatientList => _scanQrService.inPatientList;
Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
await _scanQrService.getInPatient(requestModel, false);
if (_scanQrService.hasError) {
error = _scanQrService.error;
setState(ViewState.ErrorLocal);
} else {
// setDefaultInPatientList();
setState(ViewState.Idle);
}
}
}

@ -1,10 +1,12 @@
import 'package:doctor_app_flutter/core/service/authentication_service.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
import 'package:get_it/get_it.dart';
@ -92,6 +94,7 @@ void setupLocator() {
locator.registerLazySingleton(() => PatientMedicalReportService());
locator.registerLazySingleton(() => LiveCarePatientServices());
locator.registerLazySingleton(() => NavigationService());
locator.registerLazySingleton(() => ScanQrService());
locator.registerLazySingleton(() => SpecialClinicsService());
/// View Model
@ -120,4 +123,5 @@ void setupLocator() {
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel());
}

@ -1,11 +1,9 @@
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
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/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -26,38 +24,9 @@ class QrReaderScreen extends StatefulWidget {
}
class _QrReaderScreenState extends State<QrReaderScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
bool isLoading = false;
bool isError = false;
PatientModel patient = PatientModel(
ProjectID: 15,
ClinicID: 0,
DoctorID: 1485,
FirstName: "0",
MiddleName: "0",
LastName: "0",
PatientMobileNumber: "0",
PatientIdentificationID: "0",
PatientID: 0,
From: "0",
To: "0",
LanguageID: 2,
stamp: "2020-03-02T13:56:39.170Z",
IPAdress: "11.11.11.11",
VersionID: 5.5,
Channel: 9,
TokenID: "@dm!n",
SessionID: "5G0yXn0Jnq",
IsLoginForDoctorApp: true,
PatientOutSA: false);
List<PatiantInformtion> patientList = [];
String error = '';
@override
Widget build(BuildContext context) {
return BaseView<PatientViewModel>(
onModelReady: (model) => model.getClinicsList(),
return BaseView<ScanQrViewModel>(
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
@ -95,26 +64,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
onPressed: () {
_scanQrAndGetPatient(context, model);
},
loading: isLoading,
icon: Image.asset('assets/images/qr_code_white.png'),
),
isError
? Container(
margin: EdgeInsets.only(top: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Theme.of(context).errorColor.withOpacity(0.06),
),
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
child: Row(
children: <Widget>[
Expanded(
child: AppText(error ?? TranslationBase.of(context).errorMessage,
color: Theme.of(context).errorColor)),
],
),
)
: Container(),
],
),
),
@ -124,82 +75,32 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
);
}
_scanQrAndGetPatient(BuildContext context, PatientViewModel model) async {
_scanQrAndGetPatient(BuildContext context, ScanQrViewModel model) async {
/// When give qr we will change this method to get data
/// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result
var result = await BarcodeScanner.scan();
if (result != "") {
List<String> listOfParams = result.split(',');
String patientType = "1";
setState(() {
isLoading = true;
isError = false;
patientList = [];
});
String token = await sharedPref.getString(TOKEN);
// Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
// DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
// patient.PatientID = 8808;
// patient.TokenID = token;
// patient.setDoctorID = doctorProfile.projectID;
// patient.setClinicID = doctorProfile.clinicID;
// patient.setProjectID = doctorProfile.projectID;
// Provider.of<PatientsProvider>(context, listen: false);
patient.PatientID = 8808;
patient.TokenID = token;
model.getPatientList(patient, "1", isBusyLocal: true).then((response) {
if (response['MessageStatus'] == 1) {
switch (patientType) {
case "0":
if (response['List_MyOutPatient'] != null) {
setState(() {
patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list;
isLoading = false;
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patientList[0],
});
} else {
setState(() {
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
}
break;
case "1":
if (response['List_MyInPatient'] != null) {
setState(() {
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
isLoading = false;
error = "";
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patientList[0],
});
} else {
setState(() {
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
break;
}
}
int patientID = 0;
if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]);
PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel(
patientID: patientID,
);
await model.getInPatientList(patientSearchRequestModel, isMyInpatient: true).then((d) {
if (model.state != ViewState.ErrorLocal) {
if (model.inPatientList.isEmpty)
DrAppToastMsg.showErrorToast('No patient');
else
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.inPatientList[0],
});
} else {
setState(() {
isLoading = false;
isError = true;
});
DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
DrAppToastMsg.showErrorToast(model.error);
}
}).catchError((error) {
setState(() {
isLoading = false;
});
Helpers.showErrorToast(error.message);
//DrAppToastMsg.showErrorToast(error);
});
}
}

Loading…
Cancel
Save