Merge branch 'development' into procedure_refactoring

# Conflicts:
#	lib/core/service/patient/LiveCarePatientServices.dart
merge-requests/722/head
mosazaid 5 years ago
commit 400420bd4d

@ -219,6 +219,8 @@ const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RE
const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare";
const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin";
var selectedPatientType = 1; var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************

@ -0,0 +1,27 @@
class LiveCareUserLoginRequestModel {
String tokenID;
String generalid;
int doctorId;
int isOutKsa;
int isLogin;
LiveCareUserLoginRequestModel({this.tokenID, this.generalid, this.doctorId, this.isOutKsa, this.isLogin});
LiveCareUserLoginRequestModel.fromJson(Map<String, dynamic> json) {
tokenID = json['TokenID'];
generalid = json['generalid'];
doctorId = json['DoctorId'];
isOutKsa = json['IsOutKsa'];
isLogin = json['IsLogin'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['TokenID'] = this.tokenID;
data['generalid'] = this.generalid;
data['DoctorId'] = this.doctorId;
data['IsOutKsa'] = this.isOutKsa;
data['IsLogin'] = this.isLogin;
return data;
}
}

@ -3,6 +3,7 @@ import 'dart:collection';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart';
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_req.dart'; import 'package:doctor_app_flutter/models/livecare/start_call_req.dart';
@ -28,6 +29,7 @@ class LiveCarePatientServices extends BaseService {
var endCallResponse = {}; var endCallResponse = {};
var transferToAdminResponse = {}; var transferToAdminResponse = {};
var isLoginResponse = {};
StartCallRes _startCallRes; StartCallRes _startCallRes;
@ -65,8 +67,7 @@ class LiveCarePatientServices extends BaseService {
Future startCall(StartCallReq startCallReq) async { Future startCall(StartCallReq startCallReq) async {
hasError = false; hasError = false;
await baseAppClient.post(START_LIVE_CARE_CALL, await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async {
onSuccess: (response, statusCode) async {
_startCallRes = StartCallRes.fromJson(response); _startCallRes = StartCallRes.fromJson(response);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -76,8 +77,7 @@ class LiveCarePatientServices extends BaseService {
Future endCallWithCharge(int vcID, String altServiceList) async { Future endCallWithCharge(int vcID, String altServiceList) async {
hasError = false; hasError = false;
await baseAppClient.post(END_CALL_WITH_CHARGE, await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
endCallResponse = response; endCallResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -90,8 +90,7 @@ class LiveCarePatientServices extends BaseService {
Future transferToAdmin(int vcID, String notes) async { Future transferToAdmin(int vcID, String notes) async {
hasError = false; hasError = false;
await baseAppClient.post(TRANSFERT_TO_ADMIN, await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response; transferToAdminResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -116,6 +115,16 @@ class LiveCarePatientServices extends BaseService {
}, isLiveCare: _isLive); }, isLiveCare: _isLive);
} }
Future isLogin({LiveCareUserLoginRequestModel isLoginRequestModel, int loginStatus}) async {
hasError = false;
await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async {
isLoginResponse = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: isLoginRequestModel.toJson(), isLiveCare: _isLive);
}
Future getAlternativeServices(int vcID) async { Future getAlternativeServices(int vcID) async {
hasError = false; hasError = false;
alternativeServicesList.clear(); alternativeServicesList.clear();

@ -2,6 +2,7 @@ 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/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart';
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart';
import 'package:doctor_app_flutter/core/service/home/dasboard_service.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/service/patient/LiveCarePatientServices.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
@ -15,8 +16,7 @@ import '../../locator.dart';
class LiveCarePatientViewModel extends BaseViewModel { class LiveCarePatientViewModel extends BaseViewModel {
List<PatiantInformtion> filterData = []; List<PatiantInformtion> filterData = [];
LiveCarePatientServices _liveCarePatientServices = LiveCarePatientServices _liveCarePatientServices = locator<LiveCarePatientServices>();
locator<LiveCarePatientServices>();
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes; StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
@ -32,12 +32,9 @@ class LiveCarePatientViewModel extends BaseViewModel {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} }
PendingPatientERForDoctorAppRequestModel PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel =
pendingPatientERForDoctorAppRequestModel = PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false);
PendingPatientERForDoctorAppRequestModel( await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
sErServiceID: _dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(
pendingPatientERForDoctorAppRequestModel);
if (_liveCarePatientServices.hasError) { if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error; error = _liveCarePatientServices.error;
@ -170,16 +167,11 @@ class LiveCarePatientViewModel extends BaseViewModel {
if (strExist) { if (strExist) {
filterData = []; filterData = [];
for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) { for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) {
String fullName = String fullName = _liveCarePatientServices.patientList[i].fullName.toUpperCase();
_liveCarePatientServices.patientList[i].fullName.toUpperCase(); String patientID = _liveCarePatientServices.patientList[i].patientId.toString();
String patientID = String mobile = _liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
_liveCarePatientServices.patientList[i].patientId.toString();
String mobile = if (fullName.contains(str.toUpperCase()) || patientID.contains(str) || mobile.contains(str)) {
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
if (fullName.contains(str.toUpperCase()) ||
patientID.contains(str) ||
mobile.contains(str)) {
filterData.add(_liveCarePatientServices.patientList[i]); filterData.add(_liveCarePatientServices.patientList[i]);
} }
} }
@ -190,6 +182,24 @@ class LiveCarePatientViewModel extends BaseViewModel {
} }
} }
Future isLogin(int loginStatus) async {
await getDoctorProfile(isGetProfile: true);
LiveCareUserLoginRequestModel userLoginRequestModel = new LiveCareUserLoginRequestModel();
userLoginRequestModel.isOutKsa = (doctorProfile.projectID == 2 || doctorProfile.projectID == 3) ? 1 : 0;
userLoginRequestModel.isLogin = loginStatus;
userLoginRequestModel.generalid = "Cs2020@2016\$2958";
setState(ViewState.BusyLocal);
await _liveCarePatientServices.isLogin(loginStatus: loginStatus, isLoginRequestModel: userLoginRequestModel);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
setDemoData() { setDemoData() {
alternativeServicesList.clear(); alternativeServicesList.clear();
alternativeServicesList.add( alternativeServicesList.add(

@ -30,7 +30,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
void initState() { void initState() {
super.initState(); super.initState();
timer = Timer.periodic(Duration(seconds: 10), (Timer t) { timer = Timer.periodic(Duration(seconds: 10), (Timer t) {
if(_liveCareViewModel != null){ if (_liveCareViewModel != null) {
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true); _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true);
} }
}); });
@ -38,6 +38,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
@override @override
void dispose() { void dispose() {
_liveCareViewModel.isLogin(0);
_liveCareViewModel = null; _liveCareViewModel = null;
timer?.cancel(); timer?.cancel();
super.dispose(); super.dispose();
@ -49,7 +50,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
onModelReady: (model) async { onModelReady: (model) async {
_liveCareViewModel = model; _liveCareViewModel = model;
await model.getPendingPatientERForDoctorApp(); await model.getPendingPatientERForDoctorApp();
await model.isLogin(1);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -82,7 +83,9 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
]), ]),
), ),
), ),
SizedBox(height: 20,), SizedBox(
height: 20,
),
Center( Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: .9, widthFactor: .9,
@ -90,44 +93,35 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
width: double.maxFinite, width: double.maxFinite,
height: 75, height: 75,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(Radius.circular(6.0)),
Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0,
color: Color(0xffCCCCCC), color: Color(0xffCCCCCC),
), ),
color: Colors.white), color: Colors.white),
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: Padding(
CrossAxisAlignment.start, padding: EdgeInsets.only(left: 10, top: 10),
children: [ child: AppText(
Padding( TranslationBase.of(context).searchPatientName,
padding: EdgeInsets.only( fontSize: 13,
left: 10, top: 10), )),
child: AppText( AppTextFormField(
TranslationBase.of( // focusNode: focusProject,
context) controller: _controller,
.searchPatientName, borderColor: Colors.white,
fontSize: 13, prefix: IconButton(
)), icon: Icon(
AppTextFormField( DoctorApp.filter_1,
// focusNode: focusProject, color: Colors.black,
controller: _controller, ),
borderColor: Colors.white, iconSize: 20,
prefix: IconButton( padding: EdgeInsets.only(bottom: 30),
icon: Icon( ),
DoctorApp.filter_1, onChanged: (String str) {
color: Colors.black, model.searchData(str);
), }),
iconSize: 20, ])),
padding:
EdgeInsets.only(
bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
), ),
), ),
model.state == ViewState.Idle model.state == ViewState.Idle
@ -136,44 +130,44 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
child: model.filterData.isEmpty child: model.filterData.isEmpty
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context) error: TranslationBase.of(context).youDontHaveAnyPatient,
.youDontHaveAnyPatient,
), ),
) )
: ListView.builder( : ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
patientType: "0", patientType: "0",
arrivalType: "0", arrivalType: "0",
isFromSearch: false, isFromSearch: false,
isInpatient: false, isInpatient: false,
isFromLiveCare:true, isFromLiveCare: true,
onTap: () { onTap: () {
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
PATIENTS_PROFILE, "patient": model.filterData[index],
arguments: { "patientType": "0",
"patient": model.filterData[index], "isSearch": false,
"patientType": "0", "isInpatient": false,
"isSearch": false, "arrivalType": "0",
"isInpatient": false, "isSearchAndOut": false,
"arrivalType": "0", "isFromLiveCare": true,
"isSearchAndOut": false, });
"isFromLiveCare":true, },
}); // isFromSearch: widget.isSearch,
}, ),
// isFromSearch: widget.isSearch, );
), })),
); )
})), : Expanded(
) : Expanded( child: AppLoaderWidget(
child: AppLoaderWidget(containerColor: Colors.transparent,)), containerColor: Colors.transparent,
)),
], ],
), ),
), ),

@ -421,7 +421,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
width: 5.0, width: 5.0,
), ),
PrescriptionTextFiled( PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.560, width: MediaQuery.of(context).size.width * 0.517,
element: units, element: units,
elementError: unitError, elementError: unitError,
keyName: 'description', keyName: 'description',
@ -512,7 +512,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.65, width: MediaQuery.of(context).size.width * 0.59,
color: Colors.white, color: Colors.white,
child: TextField( child: TextField(
maxLines: 5, maxLines: 5,

@ -587,7 +587,7 @@ packages:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.2" version: "0.6.3-nullsafety.1"
json_annotation: json_annotation:
dependency: transitive dependency: transitive
description: description:
@ -629,7 +629,7 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.4"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -921,7 +921,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.2"
sticky_headers: sticky_headers:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1119,5 +1119,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.10.0 <2.11.0" dart: ">=2.10.0 <=2.11.0-213.1.beta"
flutter: ">=1.22.0 <2.0.0" flutter: ">=1.22.0 <2.0.0"

Loading…
Cancel
Save