first step form Special Clinic

merge-requests/742/head
Elham Rababah 5 years ago
parent c46c339933
commit 363b55069f

@ -226,6 +226,7 @@ const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoc
const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin";
const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks_New";
const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList";
const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList";
var selectedPatientType = 1;

@ -11,20 +11,24 @@ class PatientSearchRequestModel {
int searchType;
String mobileNo;
String identificationNo;
int nursingStationID;
int clinicID;
PatientSearchRequestModel(
{this.doctorID =0,
this.firstName ="0",
this.middleName ="0",
this.lastName ="0",
this.patientMobileNumber ="0",
this.patientIdentificationID ="0",
this.patientID =0,
this.searchType =1,
this.mobileNo="",
this.identificationNo="0",
this.from ="0",
this.to ="0"});
{this.doctorID = 0,
this.firstName = "0",
this.middleName = "0",
this.lastName = "0",
this.patientMobileNumber = "0",
this.patientIdentificationID = "0",
this.patientID = 0,
this.searchType = 1,
this.mobileNo = "",
this.identificationNo = "0",
this.from = "0",
this.to = "0",
this.clinicID,
this.nursingStationID = 0});
PatientSearchRequestModel.fromJson(Map<String, dynamic> json) {
doctorID = json['DoctorID'];
@ -39,6 +43,8 @@ class PatientSearchRequestModel {
searchType = json['SearchType'];
mobileNo = json['MobileNo'];
identificationNo = json['IdentificationNo'];
nursingStationID = json['NursingStationID'];
clinicID = json['ClinicID'];
}
Map<String, dynamic> toJson() {
@ -55,6 +61,8 @@ class PatientSearchRequestModel {
data['SearchType'] = this.searchType;
data['MobileNo'] = this.mobileNo;
data['IdentificationNo'] = this.identificationNo;
data['NursingStationID'] = this.nursingStationID;
data['ClinicID'] = this.clinicID;
return data;
}
}

@ -7,8 +7,6 @@ class DashboardService extends BaseService {
List<DashboardModel> _dashboardItemsList = [];
List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
List<GetSpecialClinicalCareListResponseModel> _specialClinicalCareList = [];
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicalCareList;
bool hasVirtualClinic = false;
String sServiceID;
@ -50,24 +48,5 @@ class DashboardService extends BaseService {
},
);
}
Future getSpecialClinicalCareList() async {
hasError = false;
await getDoctorProfile(isGetProfile: true);
await baseAppClient.post(
GET_SPECIAL_CLINICAL_CARE_LIST,
onSuccess: (dynamic response, int statusCode) {
_specialClinicalCareList.clear();
response['List_SpecialClinicalCareList'].forEach((v) {
_specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v));
});},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
},
);
}
}

@ -0,0 +1,57 @@
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/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
class SpecialClinicsService extends BaseService {
List<GetSpecialClinicalCareListResponseModel> _specialClinicalCareList = [];
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicalCareList;
List<GetSpecialClinicalCareMappingListResponseModel> _specialClinicalCareMappingList = [];
List<GetSpecialClinicalCareMappingListResponseModel> get specialClinicalCareMappingList => _specialClinicalCareMappingList;
Future getSpecialClinicalCareList() async {
hasError = false;
await baseAppClient.post(
GET_SPECIAL_CLINICAL_CARE_LIST,
onSuccess: (dynamic response, int statusCode) {
_specialClinicalCareList.clear();
response['List_SpecialClinicalCareList'].forEach((v) {
_specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v));
});},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
},
);
}
Future getSpecialClinicalCareMappingList(int clinicId) async {
hasError = false;
await baseAppClient.post(
GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST,
onSuccess: (dynamic response, int statusCode) {
_specialClinicalCareMappingList.clear();
response['List_SpecialClinicalCareMappingList'].forEach((v) {
_specialClinicalCareMappingList.add(GetSpecialClinicalCareMappingListResponseModel.fromJson(v));
});},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"ClinicID": clinicId,
"DoctorID":0,
"EditedBy":0
},
);
}
}

@ -4,6 +4,8 @@ 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/patient/out_patient_service.dart';
import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
@ -12,8 +14,10 @@ import 'base_view_model.dart';
class PatientSearchViewModel extends BaseViewModel {
OutPatientService _outPatientService = locator<OutPatientService>();
SpecialClinicsService _specialClinicsService = locator<SpecialClinicsService>();
List<PatiantInformtion> get patientList => _outPatientService.patientList;
List<GetSpecialClinicalCareMappingListResponseModel> get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList;
List<PatiantInformtion> filterData = [];
@ -143,15 +147,22 @@ class PatientSearchViewModel extends BaseViewModel {
List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async {
{bool isMyInpatient = false, bool isLocalBusy = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
if(isLocalBusy) {
setState(ViewState.BusyLocal);
} else{
setState(ViewState.Busy);
}
if (inPatientList.length == 0)
await _inPatientService.getInPatientList(requestModel, false);
if (_inPatientService.hasError) {
error = _inPatientService.error;
if(isLocalBusy) {
setState(ViewState.ErrorLocal);
} else{
setState(ViewState.Error);
}
} else {
// setDefaultInPatientList();
setState(ViewState.Idle);
@ -166,6 +177,9 @@ class PatientSearchViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
void clearPatientList() {
_inPatientService.inPatientList = [];
_inPatientService.myInPatientList = [];
@ -195,4 +209,26 @@ class PatientSearchViewModel extends BaseViewModel {
notifyListeners();
}
}
getSpecialClinicalCareMappingList(clinicId,
{bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
//TODO Elham* change clinic id to dynamic
await _specialClinicsService.getSpecialClinicalCareMappingList(221);
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setState(ViewState.Idle);
}
}
}

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
@ -15,6 +16,7 @@ import 'base_view_model.dart';
class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>();
SpecialClinicsService _specialClinicsService = locator<SpecialClinicsService>();
List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList;
@ -23,7 +25,7 @@ class DashboardViewModel extends BaseViewModel {
String get sServiceID => _dashboardService.sServiceID;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _dashboardService.specialClinicalCareList;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicsService.specialClinicalCareList;
Future setFirebaseNotification(ProjectViewModel projectsProvider,
@ -70,9 +72,9 @@ class DashboardViewModel extends BaseViewModel {
Future getSpecialClinicalCareList() async {
setState(ViewState.Busy);
await _dashboardService.getSpecialClinicalCareList();
if (_dashboardService.hasError) {
error = _dashboardService.error;
await _specialClinicsService.getSpecialClinicalCareList();
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -99,4 +101,17 @@ class DashboardViewModel extends BaseViewModel {
return value.toString();
}
bool isSpecialClinic(clinicId){
bool isSpecial = false;
specialClinicalCareList.forEach((element) {
if(element.clinicID == 1){
isSpecial = true;
}
});
return isSpecial;
}
}

@ -37,6 +37,7 @@ import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart';
import 'core/service/patient_medical_file/soap/SOAP_service.dart';
import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart';
import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart';
import 'core/service/special_clinics/special_clinic_service.dart';
import 'core/viewModel/DischargedPatientViewModel.dart';
import 'core/viewModel/InsuranceViewModel.dart';
import 'core/viewModel/LiveCarePatientViewModel.dart';
@ -91,6 +92,7 @@ void setupLocator() {
locator.registerLazySingleton(() => PatientMedicalReportService());
locator.registerLazySingleton(() => LiveCarePatientServices());
locator.registerLazySingleton(() => NavigationService());
locator.registerLazySingleton(() => SpecialClinicsService());
/// View Model
locator.registerFactory(() => DoctorReplayViewModel());

@ -0,0 +1,37 @@
class GetSpecialClinicalCareMappingListResponseModel {
int mappingProjectID;
int clinicID;
int nursingStationID;
bool isActive;
int projectID;
String description;
GetSpecialClinicalCareMappingListResponseModel(
{this.mappingProjectID,
this.clinicID,
this.nursingStationID,
this.isActive,
this.projectID,
this.description});
GetSpecialClinicalCareMappingListResponseModel.fromJson(
Map<String, dynamic> json) {
mappingProjectID = json['MappingProjectID'];
clinicID = json['ClinicID'];
nursingStationID = json['NursingStationID'];
isActive = json['IsActive'];
projectID = json['ProjectID'];
description = json['Description'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['MappingProjectID'] = this.mappingProjectID;
data['ClinicID'] = this.clinicID;
data['NursingStationID'] = this.nursingStationID;
data['IsActive'] = this.isActive;
data['ProjectID'] = this.projectID;
data['Description'] = this.description;
return data;
}
}

@ -69,7 +69,6 @@ class _HomeScreenState extends State<HomeScreen> {
await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
await model.getSpecialClinicalCareList();
},
builder: (_, model, w) => AppScaffold(
@ -356,7 +355,7 @@ class _HomeScreenState extends State<HomeScreen> {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
page: PatientInPatientScreen(specialClinic: model.specialClinicalCareList[0],),
),
);
},

@ -1,17 +1,27 @@
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/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'DischargedPatientPage.dart';
import 'InPatientPage.dart';
class PatientInPatientScreen extends StatefulWidget {
GetSpecialClinicalCareListResponseModel specialClinic;
PatientInPatientScreen({Key key, this.specialClinic});
@override
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
}
@ -21,6 +31,9 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
TabController _tabController;
int _activeTab = 0;
int selectedMapId;
@override
void initState() {
super.initState();
@ -42,15 +55,23 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
final screenSize = MediaQuery
.of(context)
.size;
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
return BaseView<PatientSearchViewModel>(
onModelReady: (model) async {
model.clearPatientList();
if (widget.specialClinic != null)
await model.getSpecialClinicalCareMappingList(
widget.specialClinic.clinicID);
model.getInPatientList(requestModel);
},
builder: (_, model, w) => AppScaffold(
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Column(
@ -72,12 +93,127 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
),
Expanded(
child: AppText(
TranslationBase.of(context).inPatient,
TranslationBase
.of(context)
.inPatient,
fontSize: SizeConfig.textMultiplier * 2.8,
fontWeight: FontWeight.bold,
color: Color(0xFF2B353E),
),
),
if(model.specialClinicalCareMappingList.isNotEmpty &&
widget.specialClinic != null)
Container(
width: MediaQuery
.of(context)
.size
.width * .3,
child: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
isExpanded: true,
value: selectedMapId == null ? model
.specialClinicalCareMappingList[0]
.nursingStationID : selectedMapId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return model
.specialClinicalCareMappingList
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Container(
padding:
EdgeInsets.all(2),
margin:
EdgeInsets.all(2),
decoration:
new BoxDecoration(
color:
Colors.red[800],
borderRadius:
BorderRadius
.circular(
20),
),
constraints:
BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: Center(
child: AppText(
model
.specialClinicalCareMappingList
.length
.toString(),
color:
Colors.white,
fontSize:
projectsProvider
.isArabic
? 10
: 11,
textAlign:
TextAlign
.center,
),
)),
],
),
AppText(item.description,
fontSize: 12,
color: Colors.black,
fontWeight:
FontWeight.bold,
textAlign: TextAlign.end),
],
);
}).toList();
},
onChanged: (newValue) async {
setState(() {
selectedMapId = newValue;
});
model.clearPatientList();
GifLoaderDialogUtils.showMyDialog(
context);
PatientSearchRequestModel requestModel = PatientSearchRequestModel(
nursingStationID: selectedMapId, clinicID: 0);
await model.getInPatientList(requestModel, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(
context);
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
}
},
items: model
.specialClinicalCareMappingList
.map((item) {
return DropdownMenuItem(
child: AppText(
item.description,
textAlign: TextAlign.left,
),
value: item.nursingStationID,
);
}).toList(),
)),
)
]),
),
),

Loading…
Cancel
Save