Merge branch 'development' into procedure_refactoring

# Conflicts:
#	lib/core/service/patient/LiveCarePatientServices.dart
merge-requests/726/head
mosazaid 5 years ago
parent 400420bd4d
commit ec9f628b67

@ -5,8 +5,8 @@ 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_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -56,6 +56,8 @@ const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddRefe
const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient';
const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient';
const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals'; const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals';
const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral';
@ -179,6 +181,8 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults";
const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient";
const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferredOutPatient";
const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient";
const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient";

@ -0,0 +1,4 @@
enum PatientType{
IN_PATIENT,
OUT_PATIENT,
}

@ -42,6 +42,42 @@ class MyReferralInPatientService extends BaseService {
); );
} }
Future getMyReferralOutPatientService() async {
hasError = false;
Map<String, dynamic> body = Map();
await getDoctorProfile();
body['DoctorID'] = doctorProfile.doctorID;
body['FirstName'] = "0";
body['MiddleName'] = "0";
body['LastName'] = "0";
body['PatientMobileNumber'] = "0";
body['PatientIdentificationID'] = "0";
body['PatientID'] = 0;
body['From'] = "0";
body['To'] = "0";
body['stamp'] = DateTime.now().toIso8601String();
body['IsLoginForDoctorApp'] = true;
body['IPAdress'] = "11.11.11.11";
body['PatientOutSA'] = false;
body['PatientTypeID'] = 1;
myReferralPatients.clear();
await baseAppClient.post(
GET_MY_REFERRAL_OUTPATIENT,
onSuccess: (dynamic response, int statusCode) {
if (response['List_MyReferredOutPatient'] != null) {
response['List_MyReferredOutPatient'].forEach((v) {
myReferralPatients.add(MyReferralPatientModel.fromJson(v));
});
}
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: body,
);
}
Future replay( Future replay(
String referredDoctorRemarks, MyReferralPatientModel referral) async { String referredDoctorRemarks, MyReferralPatientModel referral) async {
hasError = false; hasError = false;

@ -157,6 +157,37 @@ class PatientReferralService extends LookupService {
); );
} }
Future getMyReferredOutPatient() async {
hasError = false;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
// _requestMyReferralPatient.doctorID = 1002;
DoctorProfileModel doctorProfile = await getDoctorProfile();
await baseAppClient.post(
GET_MY_REFERRED_OUT_PATIENT,
onSuccess: (dynamic response, int statusCode) {
listMyReferredPatientModel.clear();
response['List_MyOutPatientReferral'].forEach((v) {
MyReferredPatientModel item = MyReferredPatientModel.fromJson(v);
if (doctorProfile != null) {
item.isReferralDoctorSameBranch =
doctorProfile.projectID == item.projectID;
} else {
item.isReferralDoctorSameBranch = false;
}
listMyReferredPatientModel.add(item);
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _requestMyReferralPatient.toJson(),
);
}
Future getPendingReferralList() async { Future getPendingReferralList() async {
hasError = false; hasError = false;
DoctorProfileModel doctorProfile = await getDoctorProfile(); DoctorProfileModel doctorProfile = await getDoctorProfile();

@ -1,36 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';
class ReferredPatientService extends BaseService {
List<MyReferredPatientModel> _listMyReferredPatientModel = [];
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_listMyReferredPatientModel;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
VerifyReferralDoctorRemarks _verifyreferraldoctorremarks =
VerifyReferralDoctorRemarks();
Future getMyReferredPatient() async {
await baseAppClient.post(
GET_MY_REFERRED_PATIENT,
onSuccess: (dynamic response, int statusCode) {
_listMyReferredPatientModel.clear();
response['List_MyReferredPatient'].forEach((v) {
listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v));
});
// print(response['List_MyReferredPatient']);
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _requestMyReferralPatient.toJson(),
);
}
}

@ -28,6 +28,7 @@ class PatientReferralViewModel extends BaseViewModel {
DischargedPatientService _dischargedPatientService = DischargedPatientService _dischargedPatientService =
locator<DischargedPatientService>(); locator<DischargedPatientService>();
List<DischargeReferralPatient> get myDischargeReferralPatient => List<DischargeReferralPatient> get myDischargeReferralPatient =>
_dischargedPatientService.myDischargeReferralPatients; _dischargedPatientService.myDischargeReferralPatients;
@ -133,8 +134,11 @@ class PatientReferralViewModel extends BaseViewModel {
return null; return null;
} }
Future getMyReferredPatient() async { Future getMyReferredPatient({bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy); setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _referralPatientService.getMyReferredPatient(); await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
error = _referralPatientService.error; error = _referralPatientService.error;
@ -143,6 +147,19 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getMyReferredOutPatient({bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _referralPatientService.getMyReferredOutPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
MyReferredPatientModel getReferredPatientItem(int index) { MyReferredPatientModel getReferredPatientItem(int index) {
return listMyReferredPatientModel[index]; return listMyReferredPatientModel[index];
} }
@ -167,6 +184,16 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getMyReferralOutPatientService() async {
setState(ViewState.Busy);
await _myReferralService.getMyReferralOutPatientService();
if (_myReferralService.hasError) {
error = _myReferralService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future replay( Future replay(
String referredDoctorRemarks, MyReferralPatientModel referral) async { String referredDoctorRemarks, MyReferralPatientModel referral) async {
setState(ViewState.Busy); setState(ViewState.Busy);

@ -1,24 +0,0 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient/referred_patient_service.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class ReferredPatientViewModel extends BaseViewModel {
ReferredPatientService _referralPatientService =
locator<ReferredPatientService>();
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_referralPatientService.listMyReferredPatientModel;
Future getMyReferredPatient() async {
setState(ViewState.Busy);
await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}

@ -35,7 +35,6 @@ import 'core/service/patient/patientInPatientService.dart';
import 'core/service/patient_medical_file/prescription/prescriptions_service.dart'; import 'core/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'core/service/patient_medical_file/radiology/radiology_service.dart'; import 'core/service/patient_medical_file/radiology/radiology_service.dart';
import 'core/service/patient/referral_patient_service.dart'; import 'core/service/patient/referral_patient_service.dart';
import 'core/service/patient/referred_patient_service.dart';
import 'core/service/home/schedule_service.dart'; import 'core/service/home/schedule_service.dart';
import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/DischargedPatientViewModel.dart';
import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart';
@ -54,7 +53,6 @@ import 'core/viewModel/patient-vital-sign-viewmodel.dart';
import 'core/viewModel/prescriptions_view_model.dart'; import 'core/viewModel/prescriptions_view_model.dart';
import 'core/viewModel/radiology_view_model.dart'; import 'core/viewModel/radiology_view_model.dart';
import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referral_view_model.dart';
import 'core/viewModel/referred_view_model.dart';
import 'core/viewModel/schedule_view_model.dart'; import 'core/viewModel/schedule_view_model.dart';
GetIt locator = GetIt.instance; GetIt locator = GetIt.instance;
@ -65,7 +63,6 @@ void setupLocator() {
locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => DoctorReplyService());
locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ScheduleService());
locator.registerLazySingleton(() => ReferralPatientService()); locator.registerLazySingleton(() => ReferralPatientService());
locator.registerLazySingleton(() => ReferredPatientService());
locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => MedicineService());
locator.registerLazySingleton(() => PatientService()); locator.registerLazySingleton(() => PatientService());
locator.registerLazySingleton(() => DashboardService()); locator.registerLazySingleton(() => DashboardService());
@ -97,7 +94,6 @@ void setupLocator() {
locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => DoctorReplayViewModel());
locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ScheduleViewModel());
locator.registerFactory(() => ReferralPatientViewModel()); locator.registerFactory(() => ReferralPatientViewModel());
locator.registerFactory(() => ReferredPatientViewModel());
locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => MedicineViewModel());
locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => DashboardViewModel());

@ -42,12 +42,10 @@ class MyReferralInPatientScreen extends StatelessWidget {
: SingleChildScrollView( : SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.only(top: 70), margin: EdgeInsets.only(top: 70),
// color: Colors.white,
// height: MediaQuery.of(context).size.height,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// SizedBox(height: 50),
...List.generate( ...List.generate(
model.myReferralPatients.length, model.myReferralPatients.length,
(index) => InkWell( (index) => InkWell(

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/enum/PatientType.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/referred_patient_detail_in-paint.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred_patient_detail_in-paint.dart';
@ -6,12 +7,15 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-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/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class ReferredPatientScreen extends StatelessWidget { class ReferredPatientScreen extends StatelessWidget {
// previous design page is: MyReferredPatient
PatientType patientType = PatientType.IN_PATIENT;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PatientReferralViewModel>( return BaseView<PatientReferralViewModel>(
@ -20,7 +24,24 @@ class ReferredPatientScreen extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
appBarTitle: TranslationBase.of(context).referredPatient, appBarTitle: TranslationBase.of(context).referredPatient,
body: model.listMyReferredPatientModel == null || body: Column(
children: [
Container(
margin: EdgeInsets.only(top: 70),
child: PatientTypeRadioWidget(
(patientType) async {
this.patientType = patientType;
GifLoaderDialogUtils.showMyDialog(context);
if (patientType == PatientType.IN_PATIENT) {
await model.getMyReferredPatient(isFirstTime: false);
} else {
await model.getMyReferredOutPatient(isFirstTime: false);
}
GifLoaderDialogUtils.hideDialog(context);
},
),
),
model.listMyReferredPatientModel == null ||
model.listMyReferredPatientModel.length == 0 model.listMyReferredPatientModel.length == 0
? Center( ? Center(
child: Column( child: Column(
@ -40,19 +61,12 @@ class ReferredPatientScreen extends StatelessWidget {
], ],
), ),
) )
: SingleChildScrollView( : Expanded(
child: SingleChildScrollView(
// DoctorApplication.svc/REST/GtMyReferredPatient // DoctorApplication.svc/REST/GtMyReferredPatient
child: Container( child: Container(
margin: EdgeInsets.only(top: 70),
child: Column( child: Column(
children: [ children: [
// const Divider(
// color: Color(0xffCCCCCC),
// height: 1,
// thickness: 2,
// indent: 0,
// endIndent: 0,
// ),
...List.generate( ...List.generate(
model.listMyReferredPatientModel.length, model.listMyReferredPatientModel.length,
(index) => InkWell( (index) => InkWell(
@ -66,7 +80,9 @@ class ReferredPatientScreen extends StatelessWidget {
); );
}, },
child: PatientReferralItemWidget( child: PatientReferralItemWidget(
referralStatus:model.getReferredPatientItem(index).referralStatusDesc, referralStatus: model
.getReferredPatientItem(index)
.referralStatusDesc,
referralStatusCode: model referralStatusCode: model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralStatus, .referralStatus,
@ -74,12 +90,14 @@ class ReferredPatientScreen extends StatelessWidget {
"${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender: patientGender:
model.getReferredPatientItem(index).gender, model.getReferredPatientItem(index).gender,
referredDate: AppDateUtils.convertDateFromServerFormat( referredDate:
AppDateUtils.convertDateFromServerFormat(
model model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralDate, .referralDate,
"dd/MM/yyyy"), "dd/MM/yyyy"),
referredTime: AppDateUtils.convertDateFromServerFormat( referredTime:
AppDateUtils.convertDateFromServerFormat(
model model
.getReferredPatientItem(index) .getReferredPatientItem(index)
.referralDate, .referralDate,
@ -117,6 +135,61 @@ class ReferredPatientScreen extends StatelessWidget {
), ),
), ),
), ),
],
),
),
);
}
}
class PatientTypeRadioWidget extends StatefulWidget {
final Function(PatientType) radioOnChange;
PatientTypeRadioWidget(this.radioOnChange);
@override
_PatientTypeRadioWidgetState createState() =>
_PatientTypeRadioWidgetState(this.radioOnChange);
}
class _PatientTypeRadioWidgetState extends State<PatientTypeRadioWidget> {
final Function(PatientType) radioOnChange;
_PatientTypeRadioWidgetState(this.radioOnChange);
PatientType patientType = PatientType.IN_PATIENT;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
child: RadioListTile<PatientType>(
title: AppText(TranslationBase.of(context).inPatient),
value: PatientType.IN_PATIENT,
groupValue: patientType,
onChanged: (PatientType value) {
setState(() {
patientType = value;
radioOnChange(value);
});
},
),
),
Expanded(
child: RadioListTile<PatientType>(
title: AppText(TranslationBase.of(context).outpatient),
value: PatientType.OUT_PATIENT,
groupValue: patientType,
onChanged: (PatientType value) {
setState(() {
patientType = value;
radioOnChange(value);
});
},
),
),
],
); );
} }
} }

@ -215,7 +215,7 @@ class PatientReferralItemWidget extends StatelessWidget {
), ),
Expanded( Expanded(
child: AppText( child: AppText(
remark, remark??"",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * SizeConfig.textMultiplier, fontSize: 1.8 * SizeConfig.textMultiplier,

Loading…
Cancel
Save