in-patient re-design

merge-requests/592/head
mosazaid 5 years ago
parent 98eec8fcdb
commit 3e24278d89

@ -152,6 +152,9 @@ const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure';
const GET_PATIENT_ARRIVAL_LIST =
'Services/DoctorApplication.svc/REST/PatientArrivalList';
const GET_PATIENT_IN_PATIENT_LIST =
'Services/DoctorApplication.svc/REST/GetMyInPatient';
const Verify_Referral_Doctor_Remarks =
'Services/DoctorApplication.svc/REST/VerifyReferralDoctorRemarks';

@ -48,6 +48,7 @@ const Map<String, Map<String, String>> localizedValues = {
'service': {'en': 'Service', 'ar': 'خدمة'},
'referral': {'en': 'Referral', 'ar': 'الإحالة'},
'inPatient': {'en': 'My InPatients', 'ar': 'المريض الداخلي'},
'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى الداخليين'},
'operations': {'en': 'Operations', 'ar': 'عمليات'},
'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'},
'searchMedicine': {'en': 'Search Medicines', 'ar': 'بحث عن الدواء'},

@ -10,15 +10,15 @@ class PatientSearchRequestModel {
String to;
PatientSearchRequestModel(
{this.doctorID,
this.firstName,
this.middleName,
this.lastName,
this.patientMobileNumber,
this.patientIdentificationID,
this.patientID,
this.from,
this.to});
{this.doctorID = 0,
this.firstName = "0",
this.middleName = "0",
this.lastName = "0",
this.patientMobileNumber = "0",
this.patientIdentificationID = "0",
this.patientID = 0,
this.from = "0",
this.to = "0"});
PatientSearchRequestModel.fromJson(Map<String, dynamic> json) {
doctorID = json['DoctorID'];

@ -0,0 +1,36 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/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 PatientInPatientService extends BaseService {
List<PatiantInformtion> inPatientList = List();
Future getInPatientList(
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();
response['List_MyInPatient'].forEach((v) {
inPatientList.add(PatiantInformtion.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: requestModel.toJson(),
);
}
}

@ -1,5 +1,54 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/patientInPatientService.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class PatientSearchViewModel extends BaseViewModel{
class PatientSearchViewModel extends BaseViewModel {
PatientInPatientService _inPatientService =
locator<PatientInPatientService>();
List<PatiantInformtion> get _inPatientList => _inPatientService.inPatientList;
List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async {
setState(ViewState.Busy);
await _inPatientService.getInPatientList(requestModel, isMyInpatient);
if (_inPatientService.hasError) {
error = _inPatientService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
filteredInPatientItems.clear();
filteredInPatientItems.addAll(_inPatientList);
}
}
void filterSearchResults(String query) {
var strExist = query.length > 0 ? true : false;
if (strExist) {
filteredInPatientItems = [];
for (var i = 0; i < _inPatientList.length; i++) {
String firstName = _inPatientList[i].firstName.toUpperCase();
String lastName = _inPatientList[i].lastName.toUpperCase();
String mobile = _inPatientList[i].mobileNumber.toUpperCase();
String patientID = _inPatientList[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||
lastName.contains(query.toUpperCase()) ||
mobile.contains(query) ||
patientID.contains(query)) {
filteredInPatientItems.add(_inPatientList[i]);
}
}
notifyListeners();
} else {
filteredInPatientItems = _inPatientList;
notifyListeners();
}
}
}
}

@ -27,6 +27,7 @@ import 'core/service/patient-admission-request-service.dart';
import 'core/service/patient-doctor-referral-service.dart';
import 'core/service/patient-ucaf-service.dart';
import 'core/service/patient-vital-signs-service.dart';
import 'core/service/patientInPatientService.dart';
import 'core/service/prescriptions_service.dart';
import 'core/service/radiology_service.dart';
import 'core/service/referral_patient_service.dart';
@ -80,6 +81,7 @@ void setupLocator() {
locator.registerLazySingleton(() => ReferralService());
locator.registerLazySingleton(() => MyReferralInPatientService());
locator.registerLazySingleton(() => DischargedPatientService());
locator.registerLazySingleton(() => PatientInPatientService());
/// View Model
locator.registerFactory(() => DoctorReplayViewModel());

@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart';
import 'package:doctor_app_flutter/screens/patients/DischargedPatientPage.dart';
import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart';
import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart';
@ -30,6 +31,7 @@ import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.d
import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-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/transitions/fade_page.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -494,15 +496,21 @@ class _HomeScreenState extends State<HomeScreen> {
),
hasBorder: false,
onTap: () {
getRequestHeader(true);
Navigator.of(context)
.pushNamed(PATIENTS, arguments: {
"patientSearchForm":
_patientSearchFormValues,
"selectedType": "1",
"arrivalType": "1",
"isInpatient": true
});
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
),
);
// getRequestHeader(true);
// Navigator.of(context)
// .pushNamed(PATIENTS, arguments: {
// "patientSearchForm":
// _patientSearchFormValues,
// "selectedType": "1",
// "arrivalType": "1",
// "isInpatient": true
// });
},
),
HomePageCard(

@ -0,0 +1,189 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/PatientCard.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/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
import '../../routes.dart';
class PatientInPatientScreen extends StatefulWidget {
@override
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
}
class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
int _activeTab = 0;
TextEditingController _searchController = TextEditingController();
@override
void dispose() {
_searchController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<PatientSearchViewModel>(
onModelReady: (model) => model.getInPatientList(requestModel),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,
),
child: Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
margin: EdgeInsets.only(top: 50),
child: Row(children: [
IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.black, //Colors.black,
onPressed: () => Navigator.pop(context),
),
Expanded(
child: AppText(
TranslationBase.of(context).inPatient,
fontSize: SizeConfig.textMultiplier * 2.8,
fontWeight: FontWeight.bold,
color: Color(0xFF2B353E),
fontFamily: 'Poppins',
),
),
]),
),
),
tabsBar(context, screenSize, model),
model.filteredInPatientItems.length > 0
? Expanded(
child: Container(
margin: EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context)
.searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
model.filterSearchResults(value);
}),
const SizedBox(
height: 16,
),
...model.filteredInPatientItems.map((item) {
return PatientCard(
patientInfo: item,
patientType: "1",
arrivalType: "1",
isInpatient: true,
onTap: () {
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": item,
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
}).toList(),
],
),
),
),
)
: Container(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable)),
],
),
),
);
}
Widget tabsBar(
BuildContext context, Size screenSize, PatientSearchViewModel model) {
List<String> _tabs = [
TranslationBase.of(context).inPatientAll.toUpperCase(),
TranslationBase.of(context).inPatient.toUpperCase(),
];
return Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _tabs.map((item) {
bool _isActive = _tabs[_activeTab] == item ? true : false;
return Expanded(
child: InkWell(
onTap: () async {
setState(() {
_activeTab = _tabs.indexOf(item);
});
// GifLoaderDialogUtils.showMyDialog(
// context);
await model.getInPatientList(requestModel,
isMyInpatient: _activeTab == 1);
},
child: Center(
child: Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
_isActive
? Color(0xFFD02127 /*B8382B*/)
: Color(0xFFEAEAEA),
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center(
child: AppText(
item,
fontSize: SizeConfig.textMultiplier * 1.8,
color: _isActive ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
),
),
),
),
);
}).toList(),
),
);
}
}

@ -101,6 +101,8 @@ class TranslationBase {
String get inPatient => localizedValues['inPatient'][locale.languageCode];
String get inPatientAll => localizedValues['inPatientAll'][locale.languageCode];
String get operations => localizedValues['operations'][locale.languageCode];
String get patientServices =>

@ -4,11 +4,11 @@ class TextFieldsUtils{
static BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor,
{double borderWidth = -1}) {
{double borderWidth = -1, double borderRadius = 12}) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(12)),
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
border: Border.fromBorderSide(BorderSide(
color: borderColor,
width: borderWidth == -1 ? 2.0 : borderWidth,

Loading…
Cancel
Save