Merge branch 'fix_episode_no' into 'development'

Fix episode no

See merge request Cloud_Solution/doctor_app_flutter!758
merge-requests/757/merge
Mohammad Aljammal 5 years ago
commit fc9a2a277a

@ -41,9 +41,33 @@ class LiveCarePatientServices extends BaseService {
await baseAppClient.post( await baseAppClient.post(
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_patientList.clear();
List<PatiantInformtion> localPatientList= [];
response['List_PendingPatientList'].forEach((v) { response['List_PendingPatientList'].forEach((v) {
_patientList.add(PatiantInformtion.fromJson(v)); localPatientList.add(PatiantInformtion.fromJson(v));
});
/// add new items.
localPatientList.forEach((element) {
if ((_patientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) {
_patientList.add(element);
}
});
/// remove items.
List<PatiantInformtion> removedPatientList= [];
_patientList.forEach((element) {
if ((localPatientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) {
removedPatientList.add(element);
}
});
removedPatientList.forEach((element) {
_patientList.remove(element);
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {

@ -238,4 +238,18 @@ class LiveCarePatientViewModel extends BaseViewModel {
AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"), AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"),
); );
} }
updateInCallPatient({PatiantInformtion patient, appointmentNo}){
_liveCarePatientServices.patientList.forEach((e) {
if(e.patientId == patient.patientId) {
e.episodeNo = 0 ;
e.appointmentNo = appointmentNo;
return;
}
});
setState(ViewState.Idle);
}
} }

@ -1,12 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/config/config.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/service/VideoCallService.dart'; import 'package:doctor_app_flutter/core/service/VideoCallService.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
@ -14,11 +12,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profi
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart';
import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart'; import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -306,45 +301,48 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
: TranslationBase.of(context).initiateCall, : TranslationBase.of(context).initiateCall,
disabled: isCallStarted || model.state == ViewState.BusyLocal, disabled: isCallStarted || model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// Navigator.push(context, MaterialPageRoute(
// builder: (BuildContext context) =>
// EndCallScreen(patient:patient)));
if (isCallFinished) { if (isCallFinished) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => EndCallScreen(patient: patient))); builder: (BuildContext context) =>
EndCallScreen(patient: patient)));
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.startCall(isReCall: false, vCID: patient.vcId); await model.startCall(
isReCall: false, vCID: patient.vcId);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
await model.getDoctorProfile(); await model.getDoctorProfile();
patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); patient.appointmentNo = int.parse(model
.startCallRes.appointmentNo
.toString());
patient.episodeNo = 0; patient.episodeNo = 0;
model.updateInCallPatient(
patient: patient,
appointmentNo: int.parse(model
.startCallRes.appointmentNo
.toString()));
setState(() { setState(() {
isCallStarted = true; isCallStarted = true;
}); });
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppPermissionsUtils.requestVideoCallPermission( AppPermissionsUtils
context: context, .requestVideoCallPermission(
onTapGrant: () { context: context,
locator<VideoCallService>() onTapGrant: () {
.openVideo(model.startCallRes, patient, model.startCallRes.isRecording, callConnected, callDisconnected); locator<VideoCallService>()
}); .openVideo(
model.startCallRes,
patient,
model.startCallRes.isRecording, callConnected,
callDisconnected);
});
} }
} }
// AppPermissionsUtils.requestVideoCallPermission(
// context: context,
// onTapGrant: () {
// locator<VideoCallService>()
// .openVideo(model.startCallRes, patient, true, callConnected, callDisconnected);
// });
}, },
), ),
), ),

Loading…
Cancel
Save