Merge branch 'live_care_patient' into 'development'
Live care patient See merge request Cloud_Solution/doctor_app_flutter!682merge-requests/683/merge
commit
ef175ea224
@ -0,0 +1,22 @@
|
||||
class PendingPatientERForDoctorAppRequestModel {
|
||||
bool outSA;
|
||||
int doctorID;
|
||||
String sErServiceID;
|
||||
|
||||
PendingPatientERForDoctorAppRequestModel(
|
||||
{this.outSA, this.doctorID, this.sErServiceID});
|
||||
|
||||
PendingPatientERForDoctorAppRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
outSA = json['OutSA'];
|
||||
doctorID = json['DoctorID'];
|
||||
sErServiceID = json['SErServiceID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['OutSA'] = this.outSA;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['SErServiceID'] = this.sErServiceID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,28 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
class LiveCarePatientServices extends BaseService{
|
||||
List<PatiantInformtion> _patientList = [];
|
||||
List<PatiantInformtion> get patientList => _patientList;
|
||||
|
||||
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
|
||||
hasError = false;
|
||||
await baseAppClient.post(
|
||||
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_patientList.clear();
|
||||
response['List_PendingPatientList'].forEach((v) {
|
||||
_patientList.add(PatiantInformtion.fromJson(v));
|
||||
});
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: pendingPatientERForDoctorAppRequestModel.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,59 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
|
||||
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
|
||||
import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class LiveCarePatientViewModel extends BaseViewModel {
|
||||
getPendingPatientERForDoctorApp() async {}
|
||||
List<PatiantInformtion> filterData = [];
|
||||
|
||||
LiveCarePatientServices _liveCarePatientServices =
|
||||
locator<LiveCarePatientServices>();
|
||||
|
||||
DashboardService _dashboardService =
|
||||
locator<DashboardService>();
|
||||
|
||||
getPendingPatientERForDoctorApp() async {
|
||||
setState(ViewState.BusyLocal);
|
||||
PendingPatientERForDoctorAppRequestModel
|
||||
pendingPatientERForDoctorAppRequestModel =
|
||||
PendingPatientERForDoctorAppRequestModel(sErServiceID:_dashboardService.sServiceID, outSA: false);
|
||||
await _liveCarePatientServices
|
||||
.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
|
||||
if (_liveCarePatientServices.hasError) {
|
||||
error = _liveCarePatientServices.error;
|
||||
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else {
|
||||
filterData = _liveCarePatientServices.patientList;
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
searchData(String str) {
|
||||
var strExist= str.length > 0 ? true : false;
|
||||
if (strExist) {
|
||||
filterData = [];
|
||||
for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) {
|
||||
String fullName =
|
||||
_liveCarePatientServices.patientList[i].fullName.toUpperCase();
|
||||
String patientID =
|
||||
_liveCarePatientServices.patientList[i].patientId.toString();
|
||||
String mobile =
|
||||
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
|
||||
|
||||
if (fullName.contains(str.toUpperCase()) ||
|
||||
patientID.contains(str)|| mobile.contains(str)) {
|
||||
filterData.add(_liveCarePatientServices.patientList[i]);
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
} else {
|
||||
filterData = _liveCarePatientServices.patientList;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.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:flutter/material.dart';
|
||||
|
||||
class LiveCarePatientScreen extends StatefulWidget {
|
||||
@override
|
||||
_LiveCarePatientScreenState createState() => _LiveCarePatientScreenState();
|
||||
}
|
||||
|
||||
class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<LiveCarePatientViewModel>(
|
||||
onModelReady: (model) async {},
|
||||
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(
|
||||
"Live Care Patients",
|
||||
fontSize: SizeConfig.textMultiplier * 2.8,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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_loader_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/errors/error_message.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
|
||||
class LiveCarePatientScreen extends StatefulWidget {
|
||||
@override
|
||||
_LiveCarePatientScreenState createState() => _LiveCarePatientScreenState();
|
||||
}
|
||||
|
||||
class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
|
||||
final _controller = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<LiveCarePatientViewModel>(
|
||||
onModelReady: (model) async {
|
||||
await model.getPendingPatientERForDoctorApp();
|
||||
|
||||
},
|
||||
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(
|
||||
"Live Care Patients",
|
||||
fontSize: SizeConfig.textMultiplier * 2.8,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
Center(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: .9,
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
height: 75,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: Color(0xffCCCCCC),
|
||||
),
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, top: 10),
|
||||
child: AppText(
|
||||
TranslationBase.of(
|
||||
context)
|
||||
.searchPatientName,
|
||||
fontSize: 13,
|
||||
)),
|
||||
AppTextFormField(
|
||||
// focusNode: focusProject,
|
||||
controller: _controller,
|
||||
borderColor: Colors.white,
|
||||
prefix: IconButton(
|
||||
icon: Icon(
|
||||
DoctorApp.filter_1,
|
||||
color: Colors.black,
|
||||
),
|
||||
iconSize: 20,
|
||||
padding:
|
||||
EdgeInsets.only(
|
||||
bottom: 30),
|
||||
),
|
||||
onChanged: (String str) {
|
||||
model.searchData(str);
|
||||
}),
|
||||
])),
|
||||
),
|
||||
),
|
||||
model.state == ViewState.Idle
|
||||
? Expanded(
|
||||
child: Container(
|
||||
child: model.filterData.isEmpty
|
||||
? Center(
|
||||
child: ErrorMessage(
|
||||
error: TranslationBase.of(context)
|
||||
.youDontHaveAnyPatient,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: model.filterData.length,
|
||||
itemBuilder: (BuildContext ctxt, int index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: PatientCard(
|
||||
patientInfo: model.filterData[index],
|
||||
patientType: "0",
|
||||
arrivalType: "0",
|
||||
isFromSearch: false,
|
||||
isInpatient: false,
|
||||
isFromLiveCare:true,
|
||||
onTap: () {
|
||||
// TODO change the parameter to daynamic
|
||||
Navigator.of(context).pushNamed(
|
||||
PATIENTS_PROFILE,
|
||||
arguments: {
|
||||
"patient": model.filterData[index],
|
||||
"patientType": "0",
|
||||
"isSearch": false,
|
||||
"isInpatient": false,
|
||||
"arrivalType": "0",
|
||||
"isSearchAndOut": false,
|
||||
"isFromLiveCare":true
|
||||
});
|
||||
},
|
||||
// isFromSearch: widget.isSearch,
|
||||
),
|
||||
);
|
||||
})),
|
||||
) : Expanded(
|
||||
child: AppLoaderWidget(containerColor: Colors.transparent,)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue