Merge branch 'special_clinic' into 'development'

Special clinic

See merge request Cloud_Solution/doctor_app_flutter!742
merge-requests/741/merge
Mohammad Aljammal 5 years ago
commit 86a3dcaeb4

@ -225,6 +225,8 @@ 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;
}
}

@ -1,10 +1,12 @@
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';
class DashboardService extends BaseService {
List<DashboardModel> _dashboardItemsList = [];
List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
bool hasVirtualClinic = false;
String sServiceID;
@ -24,8 +26,6 @@ class DashboardService extends BaseService {
super.error = error;
},
body: {
// "VidaAuthTokenID":
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk"
},
);
}
@ -48,4 +48,5 @@ class DashboardService extends BaseService {
},
);
}
}

@ -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,25 @@ class PatientSearchViewModel extends BaseViewModel {
notifyListeners();
}
}
getSpecialClinicalCareMappingList(clinicId,
{bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _specialClinicsService.getSpecialClinicalCareMappingList(clinicId);
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setState(ViewState.Idle);
}
}
}

@ -2,8 +2,10 @@ 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';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
@ -14,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;
@ -22,6 +25,9 @@ class DashboardViewModel extends BaseViewModel {
String get sServiceID => _dashboardService.sServiceID;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicsService.specialClinicalCareList;
Future setFirebaseNotification(ProjectViewModel projectsProvider,
AuthenticationViewModel authProvider) async {
setState(ViewState.Busy);
@ -64,6 +70,16 @@ class DashboardViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getSpecialClinicalCareList() async {
setState(ViewState.Busy);
await _specialClinicsService.getSpecialClinicalCareList();
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future changeClinic(
int clinicId, AuthenticationViewModel authProvider) async {
setState(ViewState.BusyLocal);
@ -85,4 +101,17 @@ class DashboardViewModel extends BaseViewModel {
return value.toString();
}
GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){
GetSpecialClinicalCareListResponseModel special ;
specialClinicalCareList.forEach((element) {
if(element.clinicID == 1){
special = element;
}
});
return special;
}
}

@ -39,6 +39,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';
@ -94,6 +95,7 @@ void setupLocator() {
locator.registerLazySingleton(() => LiveCarePatientServices());
locator.registerLazySingleton(() => NavigationService());
locator.registerLazySingleton(() => ScanQrService());
locator.registerLazySingleton(() => SpecialClinicsService());
/// View Model
locator.registerFactory(() => DoctorReplayViewModel());

@ -0,0 +1,32 @@
class GetSpecialClinicalCareListResponseModel {
int projectID;
int clinicID;
String clinicDescription;
String clinicDescriptionN;
bool isActive;
GetSpecialClinicalCareListResponseModel(
{this.projectID,
this.clinicID,
this.clinicDescription,
this.clinicDescriptionN,
this.isActive});
GetSpecialClinicalCareListResponseModel.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
isActive = json['IsActive'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['IsActive'] = this.isActive;
return data;
}
}

@ -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,6 +69,7 @@ class _HomeScreenState extends State<HomeScreen> {
await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
await model.getSpecialClinicalCareList();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -287,7 +288,7 @@ class _HomeScreenState extends State<HomeScreen> {
child: ListView(
scrollDirection: Axis.horizontal,
children: [
...homePatientsCardsWidget(model),
...homePatientsCardsWidget(model, projectsProvider),
])),
SizedBox(
height: 20,
@ -305,7 +306,7 @@ class _HomeScreenState extends State<HomeScreen> {
);
}
List<Widget> homePatientsCardsWidget(DashboardViewModel model) {
List<Widget> homePatientsCardsWidget(DashboardViewModel model,projectsProvider) {
colorIndex = 0;
List<Color> backgroundColors = List(3);
@ -354,7 +355,8 @@ class _HomeScreenState extends State<HomeScreen> {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
page: PatientInPatientScreen(specialClinic: model.getSpecialClinic(clinicId??projectsProvider
.doctorClinicsList[0].clinicID),),
),
);
},

@ -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,27 @@ 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);
requestModel.nursingStationID =
model.specialClinicalCareMappingList[0].nursingStationID;
requestModel.clinicID = 0;
}
model.getInPatientList(requestModel);
},
builder: (_, model, w) => AppScaffold(
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Column(
@ -72,12 +97,125 @@ 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 &&
_activeTab != 2)
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