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_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";
@ -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_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient';
const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals';
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_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferredOutPatient";
const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient";
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(
String referredDoctorRemarks, MyReferralPatientModel referral) async {
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 {
hasError = false;
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 =
locator<DischargedPatientService>();
List<DischargeReferralPatient> get myDischargeReferralPatient =>
_dischargedPatientService.myDischargeReferralPatients;
@ -133,8 +134,11 @@ class PatientReferralViewModel extends BaseViewModel {
return null;
}
Future getMyReferredPatient() async {
setState(ViewState.Busy);
Future getMyReferredPatient({bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
@ -143,6 +147,19 @@ class PatientReferralViewModel extends BaseViewModel {
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) {
return listMyReferredPatientModel[index];
}
@ -167,6 +184,16 @@ class PatientReferralViewModel extends BaseViewModel {
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(
String referredDoctorRemarks, MyReferralPatientModel referral) async {
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/radiology/radiology_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/viewModel/DischargedPatientViewModel.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/radiology_view_model.dart';
import 'core/viewModel/referral_view_model.dart';
import 'core/viewModel/referred_view_model.dart';
import 'core/viewModel/schedule_view_model.dart';
GetIt locator = GetIt.instance;
@ -65,7 +63,6 @@ void setupLocator() {
locator.registerLazySingleton(() => DoctorReplyService());
locator.registerLazySingleton(() => ScheduleService());
locator.registerLazySingleton(() => ReferralPatientService());
locator.registerLazySingleton(() => ReferredPatientService());
locator.registerLazySingleton(() => MedicineService());
locator.registerLazySingleton(() => PatientService());
locator.registerLazySingleton(() => DashboardService());
@ -97,7 +94,6 @@ void setupLocator() {
locator.registerFactory(() => DoctorReplayViewModel());
locator.registerFactory(() => ScheduleViewModel());
locator.registerFactory(() => ReferralPatientViewModel());
locator.registerFactory(() => ReferredPatientViewModel());
locator.registerFactory(() => MedicineViewModel());
locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel());

@ -42,12 +42,10 @@ class MyReferralInPatientScreen extends StatelessWidget {
: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 70),
// color: Colors.white,
// height: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 50),
...List.generate(
model.myReferralPatients.length,
(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/screens/base/base_view.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/shared/app_scaffold_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:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class ReferredPatientScreen extends StatelessWidget {
// previous design page is: MyReferredPatient
PatientType patientType = PatientType.IN_PATIENT;
@override
Widget build(BuildContext context) {
return BaseView<PatientReferralViewModel>(
@ -20,103 +24,172 @@ class ReferredPatientScreen extends StatelessWidget {
baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).referredPatient,
body: model.listMyReferredPatientModel == null ||
model.listMyReferredPatientModel.length == 0
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 100,
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
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).referralEmptyMsg,
color: Theme.of(context).errorColor,
),
)
],
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).referralEmptyMsg,
color: Theme.of(context).errorColor,
),
)
],
),
)
: SingleChildScrollView(
// DoctorApplication.svc/REST/GtMyReferredPatient
child: Container(
margin: EdgeInsets.only(top: 70),
child: Column(
children: [
// const Divider(
// color: Color(0xffCCCCCC),
// height: 1,
// thickness: 2,
// indent: 0,
// endIndent: 0,
// ),
...List.generate(
model.listMyReferredPatientModel.length,
(index) => InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferredPatientDetailScreen(
model.getReferredPatientItem(index)),
)
: Expanded(
child: SingleChildScrollView(
// DoctorApplication.svc/REST/GtMyReferredPatient
child: Container(
child: Column(
children: [
...List.generate(
model.listMyReferredPatientModel.length,
(index) => InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferredPatientDetailScreen(
model.getReferredPatientItem(index)),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model
.getReferredPatientItem(index)
.referralStatusDesc,
referralStatusCode: model
.getReferredPatientItem(index)
.referralStatus,
patientName:
"${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender:
model.getReferredPatientItem(index).gender,
referredDate:
AppDateUtils.convertDateFromServerFormat(
model
.getReferredPatientItem(index)
.referralDate,
"dd/MM/yyyy"),
referredTime:
AppDateUtils.convertDateFromServerFormat(
model
.getReferredPatientItem(index)
.referralDate,
"hh:mm a"),
patientID:
"${model.getReferredPatientItem(index).patientID}",
isSameBranch: model
.getReferredPatientItem(index)
.isReferralDoctorSameBranch,
isReferral: false,
remark: model
.getReferredPatientItem(index)
.referringDoctorRemarks,
nationality: model
.getReferredPatientItem(index)
.nationalityName,
nationalityFlag: model
.getReferredPatientItem(index)
.nationalityFlagURL,
doctorAvatar: model
.getReferredPatientItem(index)
.doctorImageURL,
referralDoctorName:
"${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}",
clinicDescription: model
.getReferredPatientItem(index)
.referralClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
),
),
);
},
child: PatientReferralItemWidget(
referralStatus:model.getReferredPatientItem(index).referralStatusDesc,
referralStatusCode: model
.getReferredPatientItem(index)
.referralStatus,
patientName:
"${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender:
model.getReferredPatientItem(index).gender,
referredDate: AppDateUtils.convertDateFromServerFormat(
model
.getReferredPatientItem(index)
.referralDate,
"dd/MM/yyyy"),
referredTime: AppDateUtils.convertDateFromServerFormat(
model
.getReferredPatientItem(index)
.referralDate,
"hh:mm a"),
patientID:
"${model.getReferredPatientItem(index).patientID}",
isSameBranch: model
.getReferredPatientItem(index)
.isReferralDoctorSameBranch,
isReferral: false,
remark: model
.getReferredPatientItem(index)
.referringDoctorRemarks,
nationality: model
.getReferredPatientItem(index)
.nationalityName,
nationalityFlag: model
.getReferredPatientItem(index)
.nationalityFlagURL,
doctorAvatar: model
.getReferredPatientItem(index)
.doctorImageURL,
referralDoctorName:
"${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}",
clinicDescription: model
.getReferredPatientItem(index)
.referralClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
),
),
],
),
),
],
),
),
),
),
],
),
),
);
}
}
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(
child: AppText(
remark,
remark??"",
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 * SizeConfig.textMultiplier,

Loading…
Cancel
Save