|
|
|
@ -6,6 +6,7 @@ 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/SOAP_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.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/live_care/end_call_screen.dart';
|
|
|
|
@ -218,7 +219,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: Container()),
|
|
|
|
|
if (patient.episodeNo == 0)
|
|
|
|
|
if (patient.episodeNo == 0 || isInpatient)
|
|
|
|
|
AppButton(
|
|
|
|
|
title:
|
|
|
|
|
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
|
|
|
|
@ -241,19 +242,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if ((isFromLiveCare && patient.appointmentNo != null) ||
|
|
|
|
|
patient.patientStatusType == 43) {
|
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
|
eventCategory: "Patient Profile",
|
|
|
|
|
eventAction: "Create Episode",
|
|
|
|
|
);
|
|
|
|
|
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(
|
|
|
|
|
appointmentNo: int.parse(patient.appointmentNo.toString()),
|
|
|
|
|
patientMRN: patient.patientMRN);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.postEpisode(postEpisodeReqModel);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
patient.episodeNo = model.episodeID;
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
|
|
|
|
|
createEpisode(patient:patient, model:model);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
@ -387,6 +376,39 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createEpisode({PatiantInformtion patient, SOAPViewModel model}) async{
|
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
|
eventCategory: "Patient Profile",
|
|
|
|
|
eventAction: "Create Episode",
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
if (patient.admissionNo == null ||patient.admissionNo.isNotEmpty ) {
|
|
|
|
|
PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel(
|
|
|
|
|
admissionNo: int.parse(patient.admissionNo),
|
|
|
|
|
patientID: patient.patientId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
await model.postEpisodeForInPatient(postEpisodeReqModel);
|
|
|
|
|
}else{
|
|
|
|
|
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(
|
|
|
|
|
appointmentNo: int.parse(patient.appointmentNo.toString()),
|
|
|
|
|
patientMRN: patient.patientMRN);
|
|
|
|
|
|
|
|
|
|
await model.postEpisode(postEpisodeReqModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if(model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
}else{
|
|
|
|
|
patient.episodeNo = model.episodeID;
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AvatarWidget extends StatelessWidget {
|
|
|
|
|