episode to inpatient

merge-requests/816/head
Elham Rababh 4 years ago
parent 46698a4382
commit cc26053bc1

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -324,6 +324,8 @@ class SOAPService extends LookupService {
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
episodeID = response["GetEpisodeNo"];
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -444,7 +444,7 @@ class SOAPViewModel extends BaseViewModel {
} }
Future getEpisodeForInpatient(PatiantInformtion patient) async { Future getEpisodeForInpatient(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel =
GetEpisodeForInpatientReqModel( GetEpisodeForInpatientReqModel(
patientID: patient.patientId, patientID: patient.patientId,
@ -453,9 +453,12 @@ class SOAPViewModel extends BaseViewModel {
await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel); await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else {
patient.episodeNo = _SOAPService.episodeID;
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
// ignore: missing_return // ignore: missing_return

@ -32,7 +32,8 @@ class PatientProfileScreen extends StatefulWidget {
_PatientProfileScreenState createState() => _PatientProfileScreenState(); _PatientProfileScreenState createState() => _PatientProfileScreenState();
} }
class _PatientProfileScreenState extends State<PatientProfileScreen> with SingleTickerProviderStateMixin { class _PatientProfileScreenState extends State<PatientProfileScreen>
with SingleTickerProviderStateMixin {
PatiantInformtion patient; PatiantInformtion patient;
LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel();
@ -55,6 +56,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
StreamController<String> videoCallDurationStreamController; StreamController<String> videoCallDurationStreamController;
Stream<String> videoCallDurationStream = (() async* {})(); Stream<String> videoCallDurationStream = (() async* {})();
@override @override
void initState() { void initState() {
_tabController = TabController(length: 2, vsync: this); _tabController = TabController(length: 2, vsync: this);
@ -109,8 +111,10 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
} }
StreamSubscription callTimer; StreamSubscription callTimer;
callConnected() { callConnected() {
callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) callTimer =
CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null)
..onDone(() { ..onDone(() {
callTimer.cancel(); callTimer.cancel();
}) })
@ -134,12 +138,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<LiveCarePatientViewModel>( return BaseView<LiveCarePatientViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId); if (isFromLiveCare && patient.patientStatus == 1)
await model.addPatientToDoctorList(patient.vcId);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile, appBarTitle: TranslationBase.of(context).patientProfile,
isShowAppBar: false, isShowAppBar: false,
body: Column( body: Column(
@ -148,11 +151,13 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
children: [ children: [
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType, PatientProfileHeaderNewDesignAppBar(
patient, arrivalType ?? '0', patientType,
videoCallDurationStream: videoCallDurationStream, videoCallDurationStream: videoCallDurationStream,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare, isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null && patient.patientStatusType == 43) height: (patient.patientStatusType != null &&
patient.patientStatusType == 43)
? 210 ? 210
: isDischargedPatient : isDischargedPatient
? 240 ? 240
@ -184,7 +189,8 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
isInpatient: isInpatient, isInpatient: isInpatient,
from: from, from: from,
to: to, to: to,
isDischargedPatient: isDischargedPatient, isDischargedPatient:
isDischargedPatient,
isFromSearch: isFromSearch, isFromSearch: isFromSearch,
) )
: ProfileGridForOther( : ProfileGridForOther(
@ -205,12 +211,18 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
), ),
], ],
), ),
if ( (isInpatient )? true:isFromLiveCare if ((isInpatient)
? true
: isFromLiveCare
? patient.episodeNo != null ? patient.episodeNo != null
: patient.patientStatusType != null && patient.patientStatusType == 43) : patient.patientStatusType != null &&
patient.patientStatusType == 43)
BaseView<SOAPViewModel>( BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.getDoctorProfile(); model.getDoctorProfile();
if (isInpatient) {
await model.getEpisodeForInpatient(patient);
}
}, },
builder: (_, model, w) => Positioned( builder: (_, model, w) => Positioned(
top: 180, top: 180,
@ -219,11 +231,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
child: Row( child: Row(
children: [ children: [
Expanded(child: Container()), Expanded(child: Container()),
if (patient.episodeNo == 0 || isInpatient) if (patient.episodeNo == 0)
AppButton( AppButton(
title: title:
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
color: isFromLiveCare ||isInpatient color: isFromLiveCare || isInpatient
? Colors.red.shade700 ? Colors.red.shade700
: patient.patientStatusType == 43 : patient.patientStatusType == 43
? Colors.red.shade700 ? Colors.red.shade700
@ -240,9 +252,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
height: 30, height: 30,
), ),
onPressed: () async { onPressed: () async {
if ((isFromLiveCare && patient.appointmentNo != null) || if ((isFromLiveCare &&
patient.appointmentNo != null) ||
patient.patientStatusType == 43) { patient.patientStatusType == 43) {
createEpisode(patient:patient, model:model); createEpisode(
patient: patient, model: model);
} }
}, },
), ),
@ -250,7 +264,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
AppButton( AppButton(
title: title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color: (isInpatient ) || isFromLiveCare color: (isInpatient) || isFromLiveCare
? Colors.red.shade700 ? Colors.red.shade700
: patient.patientStatusType == 43 : patient.patientStatusType == 43
? Colors.red.shade700 ? Colors.red.shade700
@ -267,16 +281,19 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
height: 30, height: 30,
), ),
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>()
.logEvent(
eventCategory: "Patient Profile ", eventCategory: "Patient Profile ",
eventAction: "Update Episode", eventAction: "Update Episode",
); );
if ((isFromLiveCare && if ((isFromLiveCare &&
patient.appointmentNo != null && patient.appointmentNo != null &&
patient.appointmentNo != 0) || patient.appointmentNo != 0) ||
patient.patientStatusType == 43 ||isInpatient ) { patient.patientStatusType == 43 ||
Navigator.of(context) isInpatient) {
.pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); Navigator.of(context).pushNamed(
UPDATE_EPISODE,
arguments: {'patient': patient});
} }
}), }),
], ],
@ -308,11 +325,14 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
child: Center( child: Center(
child: AppButton( child: AppButton(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: isCallFinished ? Colors.red[600] : Colors.green[600], color: isCallFinished
? Colors.red[600]
: Colors.green[600],
title: isCallFinished title: isCallFinished
? TranslationBase.of(context).endCall ? TranslationBase.of(context).endCall
: TranslationBase.of(context).initiateCall, : TranslationBase.of(context).initiateCall,
disabled: isCallStarted || model.state == ViewState.BusyLocal, disabled: isCallStarted ||
model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// TODO MOSA TEST // TODO MOSA TEST
// AppPermissionsUtils // AppPermissionsUtils
@ -330,32 +350,47 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => EndCallScreen(patient: patient),settings: RouteSettings(name: 'EndCallScreen'),),); builder: (BuildContext context) =>
EndCallScreen(patient: patient),
settings:
RouteSettings(name: 'EndCallScreen'),
),
);
} 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( model.updateInCallPatient(
patient: patient, patient: patient,
appointmentNo: int.parse(model.startCallRes.appointmentNo.toString())); appointmentNo: int.parse(model
.startCallRes.appointmentNo
.toString()));
setState(() { setState(() {
isCallStarted = true; isCallStarted = true;
}); });
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppPermissionsUtils.requestVideoCallPermission( AppPermissionsUtils
.requestVideoCallPermission(
context: context, context: context,
onTapGrant: () { onTapGrant: () {
locator<VideoCallService>().openVideo( locator<VideoCallService>()
.openVideo(
model.startCallRes, model.startCallRes,
patient, patient,
model.startCallRes != null ? model.startCallRes.isRecording : true, model.startCallRes != null
? model.startCallRes
.isRecording
: true,
callConnected, callConnected,
callDisconnected); callDisconnected);
}); });
@ -377,21 +412,19 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
); );
} }
createEpisode({PatiantInformtion patient, SOAPViewModel model}) async{ createEpisode({PatiantInformtion patient, SOAPViewModel model}) async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "Patient Profile", eventCategory: "Patient Profile",
eventAction: "Create Episode", eventAction: "Create Episode",
); );
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
if (patient.admissionNo == null ||patient.admissionNo.isNotEmpty ) { if (patient.admissionNo == null || patient.admissionNo.isNotEmpty) {
PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel( PostEpisodeForInpatientRequestModel postEpisodeReqModel =
PostEpisodeForInpatientRequestModel(
admissionNo: int.parse(patient.admissionNo), admissionNo: int.parse(patient.admissionNo),
patientID: patient.patientId patientID: patient.patientId);
);
await model.postEpisodeForInPatient(postEpisodeReqModel); await model.postEpisodeForInPatient(postEpisodeReqModel);
}else{ } else {
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(
appointmentNo: int.parse(patient.appointmentNo.toString()), appointmentNo: int.parse(patient.appointmentNo.toString()),
patientMRN: patient.patientMRN); patientMRN: patient.patientMRN);
@ -400,14 +433,13 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
}else{ } else {
patient.episodeNo = model.episodeID; patient.episodeNo = model.episodeID;
Navigator.of(context) Navigator.of(context)
.pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); .pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
} }
} }
} }
@ -420,7 +452,12 @@ class AvatarWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)], boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
borderRadius: BorderRadius.all(Radius.circular(35.0)), borderRadius: BorderRadius.all(Radius.circular(35.0)),
color: Color(0xffCCCCCC), color: Color(0xffCCCCCC),
), ),

Loading…
Cancel
Save