livecare changes

merge-requests/722/head
mosazaid 5 years ago
parent 66d12f8fdd
commit 5d0a7a4045

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -89,6 +89,7 @@ const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RES
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin';
const GET_ALTERNATIVE_SERVICE = 'LiveCareApi/DoctorApp/GetAlternativeServices';
const END_CALL = 'LiveCareApi/DoctorApp/EndCall';
const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge';
const GET_DASHBOARD = 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI';

@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
class AlternativeService {
int serviceID;
String serviceName;
bool isSelected;
AlternativeService(
{this.serviceID, this.serviceName, this.isSelected = false});
AlternativeService.fromJson(Map<String, dynamic> json) {
serviceID = json['ServicID'];
serviceName = json['ServiceName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ServicID'] = this.serviceID;
data['ServiceName'] = this.serviceName;
return data;
}
}
class AlternativeServicesList with ChangeNotifier {
List<AlternativeService> _alternativeServicesList;
getServicesList(){
return _alternativeServicesList;
}
setServicesList(List<AlternativeService> alternativeServicesList) {
this._alternativeServicesList = alternativeServicesList;
notifyListeners();
}
setSelected(AlternativeService service, bool isSelected) {
List<AlternativeService> alternativeService = _alternativeServicesList.where((element) => service.serviceID == element.serviceID).toList();
alternativeService[0].isSelected = isSelected;
notifyListeners();
}
}

@ -1,4 +1,7 @@
import 'dart:collection';
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/PendingPatientERForDoctorAppRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
@ -11,24 +14,28 @@ class LiveCarePatientServices extends BaseService {
List<PatiantInformtion> get patientList => _patientList;
List<AlternativeService> alternativeServicesList = [];
bool _isFinished = false;
bool _isLive = false;
bool get isFinished => _isFinished;
setFinished(bool isFinished){
setFinished(bool isFinished) {
_isFinished = isFinished;
}
var endCallResponse = {};
var transferToAdminResponse = {};
StartCallRes _startCallRes;
StartCallRes get startCallRes => _startCallRes;
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
Future getPendingPatientERForDoctorApp(
PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel) async {
hasError = false;
await baseAppClient.post(
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
@ -49,58 +56,67 @@ class LiveCarePatientServices extends BaseService {
Future endCall(EndCallReq endCallReq) async {
hasError = false;
await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async {
endCallResponse = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: endCallReq.toJson(),isLiveCare:_isLive);
}, body: endCallReq.toJson(), isLiveCare: _isLive);
}
Future startCall(StartCallReq startCallReq) async {
hasError = false;
await baseAppClient.post(START_LIVE_CARE_CALL,
onSuccess: (response, statusCode) async {
_startCallRes = StartCallRes.fromJson(response);
_startCallRes = StartCallRes.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: startCallReq.toJson(),isLiveCare:_isLive);
}, body: startCallReq.toJson(), isLiveCare: _isLive);
}
Future endCallWithCharge(int vcID) async{
Future endCallWithCharge(int vcID) async {
hasError = false;
await baseAppClient.post(
END_CALL_WITH_CHARGE,
onSuccess: (dynamic response, int statusCode) {
endCallResponse = response;
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"VC_ID": vcID,"generalid":"Cs2020@2016\$2958",
},isLiveCare:_isLive
);
await baseAppClient.post(END_CALL_WITH_CHARGE,
onSuccess: (dynamic response, int statusCode) {
endCallResponse = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"VC_ID": vcID,
"generalid": "Cs2020@2016\$2958",
}, isLiveCare: _isLive);
}
Future transferToAdmin(int vcID, String notes) async{
Future transferToAdmin(int vcID, String notes) async {
hasError = false;
await baseAppClient.post(
TRANSFERT_TO_ADMIN,
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response;
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"VC_ID": vcID,
"IsOutKsa": false,
"Notes": notes,
},isLiveCare:_isLive
);
await baseAppClient.post(TRANSFERT_TO_ADMIN,
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"VC_ID": vcID,
"IsOutKsa": false,
"Notes": notes,
}, isLiveCare: _isLive);
}
Future getAlternativeServices(int vcID) async {
hasError = false;
alternativeServicesList.clear();
await baseAppClient.post(GET_ALTERNATIVE_SERVICE,
onSuccess: (dynamic response, int statusCode) {
response['AlternativeServicesList'].forEach((v) {
alternativeServicesList.add(AlternativeService.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"VC_ID": vcID,
}, isLiveCare: _isLive);
}
}
}

@ -1,5 +1,6 @@
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/model/live_care/AlternativeServicesList.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';
@ -19,6 +20,8 @@ class LiveCarePatientViewModel extends BaseViewModel {
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
List<AlternativeService> get alternativeServicesList => _liveCarePatientServices.alternativeServicesList;
DashboardService _dashboardService = locator<DashboardService>();
getPendingPatientERForDoctorApp({bool isFromTimer = false}) async {
@ -115,6 +118,17 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
}
Future getAlternativeServices(int vcID) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices.getAlternativeServices(vcID);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
searchData(String str) {
var strExist = str.length > 0 ? true : false;
if (strExist) {
@ -139,4 +153,53 @@ class LiveCarePatientViewModel extends BaseViewModel {
notifyListeners();
}
}
// AlternativeServicesList demoServicesList = AlternativeServicesList();
setDemoData(){
alternativeServicesList.clear();
alternativeServicesList.add(
AlternativeService(serviceID: 1, serviceName: "Medicine Home Delivery"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 2, serviceName: "LABORATORY"),
);
alternativeServicesList.add(
AlternativeService(
serviceID: 3, serviceName: "RADIOLOGY(ULTRASOUND) For pregnant only"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 4, serviceName: "VACCINATIONS"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 5, serviceName: "ER SERVICES"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 6, serviceName: "PHYSIOTHERAPY"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 7, serviceName: "DRESSING"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 8, serviceName: "INJECTION"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 9, serviceName: "FAMILY MEDICIN DR"),
);
alternativeServicesList.add(
AlternativeService(
serviceID: 10, serviceName: "FOLYS CATHETER INSERTION"),
);
alternativeServicesList.add(
AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"),
);
}
setSelected(AlternativeService service, bool isSelected) {
int index = alternativeServicesList.indexOf(service);
if(index !=-1)
alternativeServicesList[index].isSelected = isSelected;
notifyListeners();
}
}

@ -13,6 +13,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart';
import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart';
import 'package:doctor_app_flutter/screens/home/home_patient_card.dart';
import 'package:doctor_app_flutter/screens/live_care/TestScreen.dart';
import 'package:doctor_app_flutter/screens/live_care/live_care_patient_screen.dart';
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart';
@ -341,6 +342,7 @@ class _HomeScreenState extends State<HomeScreen> {
context,
FadePage(
page: LiveCarePatientScreen(),
// page: TestScreen(),
),
);
},

@ -0,0 +1,136 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.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/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/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class TestScreen extends StatefulWidget {
@override
_TestScreenState createState() => _TestScreenState();
}
class _TestScreenState extends State<TestScreen> {
@override
Widget build(BuildContext context) {
return BaseView<LiveCarePatientViewModel>(
onModelReady: (model) => model.setDemoData(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: false,
body: Container(
child: Center(
child: AppButton(
fontWeight: FontWeight.w700,
color: Colors.red[600],
title: "open dialog", //TranslationBase.of(context).close,
onPressed: () {
showAlternativesDialog(context, model, () {
model.alternativeServicesList.map((e) => () {
if (e.isSelected) {
print(e.serviceName);
}
});
Navigator.of(context).pop();
});
},
),
),
),
),
);
}
showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model, Function okFunction) {
return showDialog(
context: context,
barrierDismissible: false, // user must tap button!
builder: (_) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AlertDialog(
title: null,
content: Container(
height: MediaQuery.of(context).size.height / 2,
child: CheckBoxListWidget(model: model,),
),
actions: [
AppButton(
onPressed: (){
okFunction();
},
title: TranslationBase.of(context).noteConfirm,
fontColor: Colors.white,
color: Colors.green[600],
),
AppButton(
onPressed: () {
Navigator.of(context).pop();
},
title: TranslationBase.of(context).cancel,
fontColor: Colors.white,
color: Colors.red[600],
),
],
),
],
),
);
});
}
}
class CheckBoxListWidget extends StatefulWidget {
final LiveCarePatientViewModel model;
const CheckBoxListWidget({
Key key, this.model,
}) : super(key: key);
@override
_CheckBoxListState createState() => _CheckBoxListState();
}
class _CheckBoxListState extends State<CheckBoxListWidget> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
...widget.model
.alternativeServicesList
.map(
(element) => Container(
child: CheckboxListTile(
title: AppText(
element.serviceName,
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 2.2,
),
value: element.isSelected,
onChanged: (newValue) {
setState(() {
widget.model.setSelected(
element, newValue);
});
},
activeColor: Color(0xFFD02127),
controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0),
),
),
)
.toList()
],
),
);
}
}

@ -108,6 +108,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
} else {
// todo mosa add new service
Navigator.of(context).pop();
Navigator.of(context).pop();
}

Loading…
Cancel
Save