From df40a2dc0929f749e89a3099757accb72dc17f3f Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 30 Aug 2021 09:20:35 +0300 Subject: [PATCH 1/5] first step from create episode inpatint --- lib/config/config.dart | 5 +- .../soap/SOAP_service.dart | 13 +++++ lib/core/viewModel/SOAP_view_model.dart | 11 ++++ .../PostEpisodeForInpatientRequestModel.dart | 22 ++++++++ .../patient_profile_screen.dart | 50 +++++++++++++------ 5 files changed, 85 insertions(+), 16 deletions(-) create mode 100644 lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 8616a2f7..d192c31b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -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"; @@ -133,6 +133,7 @@ const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; +const POST_EPISODE_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/PostEpisode'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index b2e0d603..3422f750 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; @@ -63,6 +64,18 @@ class SOAPService extends LookupService { }, body: postEpisodeReqModel.toJson()); } + Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async { + hasError = false; + + await baseAppClient.post(POST_EPISODE_FOR_IN_PATIENT, + onSuccess: (dynamic response, int statusCode) { + episodeID = response['EpisodeID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeForInpatientRequestModel.toJson()); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { hasError = false; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index d42098a2..7fa9182e 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -19,6 +19,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; @@ -176,6 +177,16 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postEpisodeForInPatient(postEpisodeForInpatientRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postAllergy(postAllergyRequestModel); diff --git a/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart b/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart new file mode 100644 index 00000000..2dff7a60 --- /dev/null +++ b/lib/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart @@ -0,0 +1,22 @@ +class PostEpisodeForInpatientRequestModel { + int admissionNo; + int patientID; + int patientTypeID; + + PostEpisodeForInpatientRequestModel( + {this.admissionNo, this.patientID, this.patientTypeID = 1}); + + PostEpisodeForInpatientRequestModel.fromJson(Map json) { + admissionNo = json['AdmissionNo']; + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['AdmissionNo'] = this.admissionNo; + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index eec42b86..dec07ec2 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -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 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 with Single onPressed: () async { if ((isFromLiveCare && patient.appointmentNo != null) || patient.patientStatusType == 43) { - await locator().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 with Single ), ); } + + createEpisode({PatiantInformtion patient, SOAPViewModel model}) async{ + await locator().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 { From b707857526416e0b5ce49304b6a2d26021aaa477 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 5 Sep 2021 10:48:55 +0300 Subject: [PATCH 2/5] first step from get episode id --- lib/config/config.dart | 2 + .../soap/SOAP_service.dart | 14 +++ lib/core/viewModel/SOAP_view_model.dart | 94 ++++++++++++------- .../GetEpisodeForInpatientReqModel.dart | 22 +++++ 4 files changed, 100 insertions(+), 32 deletions(-) create mode 100644 lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index d192c31b..7877c6c9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -238,6 +238,8 @@ const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor"; const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue"; const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse"; const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts"; +const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL"; +const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient"; var selectedPatientType = 1; diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 3422f750..92cbc1ba 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -315,4 +316,17 @@ class SOAPService extends LookupService { super.error = error; }, body: getAssessmentReqModel.toJson()); } + + Future getEpisodeForInpatient( + GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel) async { + hasError = false; + await baseAppClient.post(GET_EPISODE_FOR_INPATIENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getEpisodeForInpatientReqModel.toJson()); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 7fa9182e..79d9c54f 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -19,6 +19,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -90,56 +91,64 @@ class SOAPViewModel extends BaseViewModel { List get patientAssessmentList => _SOAPService.patientAssessmentList; + int get episodeID => _SOAPService.episodeID; bool isAddProgress = true; bool isAddExamInProgress = true; - String progressNoteText =""; + String progressNoteText = ""; String complaintsControllerError = ''; String medicationControllerError = ''; String illnessControllerError = ''; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; + get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; + get medicationRouteList => _SOAPService.medicationRouteListWithModel; + get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel; + List get allMedicationList => _prescriptionService.allMedicationList; SubjectiveCallBack subjectiveCallBack; - setSubjectiveCallBack(SubjectiveCallBack callBack) - { + + setSubjectiveCallBack(SubjectiveCallBack callBack) { this.subjectiveCallBack = callBack; } - nextOnSubjectPage(model){ + + nextOnSubjectPage(model) { subjectiveCallBack.nextFunction(model); - } + } ObjectiveCallBack objectiveCallBack; - setObjectiveCallBack(ObjectiveCallBack callBack) - { + + setObjectiveCallBack(ObjectiveCallBack callBack) { this.objectiveCallBack = callBack; } - nextOnObjectivePage(model){ + + nextOnObjectivePage(model) { objectiveCallBack.nextFunction(model); } - AssessmentCallBack assessmentCallBack; - setAssessmentCallBack(AssessmentCallBack callBack) - { + + setAssessmentCallBack(AssessmentCallBack callBack) { this.assessmentCallBack = callBack; } - nextOnAssessmentPage(model){ + + nextOnAssessmentPage(model) { assessmentCallBack.nextFunction(model); } PlanCallBack planCallBack; - setPlanCallBack(PlanCallBack callBack) - { + + setPlanCallBack(PlanCallBack callBack) { this.planCallBack = callBack; } - nextOnPlanPage(model){ + + nextOnPlanPage(model) { planCallBack.nextFunction(model); } @@ -177,9 +186,12 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async { + Future postEpisodeForInPatient( + PostEpisodeForInpatientRequestModel + postEpisodeForInpatientRequestModel) async { setState(ViewState.BusyLocal); - await _SOAPService.postEpisodeForInPatient(postEpisodeForInpatientRequestModel); + await _SOAPService.postEpisodeForInPatient( + postEpisodeForInpatientRequestModel); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -372,19 +384,22 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientPhysicalExam(PatiantInformtion patientInfo, - ) async { - - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( + Future getPatientPhysicalExam( + PatiantInformtion patientInfo, + ) async { + GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo == null?"0":patientInfo.episodeNo.toString(), - appointmentNo: patientInfo.appointmentNo == null ?0:int.parse( - patientInfo.appointmentNo.toString(), - ), + episodeID: patientInfo.episodeNo == null + ? "0" + : patientInfo.episodeNo.toString(), + appointmentNo: patientInfo.appointmentNo == null + ? 0 + : int.parse( + patientInfo.appointmentNo.toString(), + ), ); - if(patientInfo.admissionNo !=null &&patientInfo.admissionNo.isNotEmpty) - getPhysicalExamReqModel.admissionNo =int.parse(patientInfo.admissionNo); + if (patientInfo.admissionNo != null && patientInfo.admissionNo.isNotEmpty) + getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo); else getPhysicalExamReqModel.admissionNo = 0; setState(ViewState.Busy); @@ -428,6 +443,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getEpisodeForInpatient(PatiantInformtion patient) async { + setState(ViewState.Busy); + GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = + GetEpisodeForInpatientReqModel( + patientID: patient.patientId, + admissionNo: int.parse(patient.admissionNo), + patientTypeID: 1); + await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + // ignore: missing_return MasterKeyModel getOneMasterKey( {@required MasterKeysService masterKeys, dynamic id, int typeId}) { @@ -541,14 +571,14 @@ class SOAPViewModel extends BaseViewModel { } } - int getFirstIndexForOldExamination(List mySelectedExamination){ - Iterable examList = mySelectedExamination.where( - (element) => !element.isLocal); + int getFirstIndexForOldExamination( + List mySelectedExamination) { + Iterable examList = + mySelectedExamination.where((element) => !element.isLocal); if (examList.length > 0) { return mySelectedExamination.indexOf(examList.first); } else return -1; - } } diff --git a/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart b/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart new file mode 100644 index 00000000..2b49066e --- /dev/null +++ b/lib/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart @@ -0,0 +1,22 @@ +class GetEpisodeForInpatientReqModel { + int patientID; + int patientTypeID; + int admissionNo; + + GetEpisodeForInpatientReqModel( + {this.patientID, this.patientTypeID, this.admissionNo}); + + GetEpisodeForInpatientReqModel.fromJson(Map json) { + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + admissionNo = json['AdmissionNo']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['AdmissionNo'] = this.admissionNo; + return data; + } +} From cc26053bc186c8ff0b3ba463df875331f0cc9878 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 5 Sep 2021 11:19:26 +0300 Subject: [PATCH 3/5] episode to inpatient --- lib/config/config.dart | 4 +- .../soap/SOAP_service.dart | 2 + lib/core/viewModel/SOAP_view_model.dart | 9 +- .../patient_profile_screen.dart | 157 +++++++++++------- 4 files changed, 107 insertions(+), 65 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index dfb55dea..57bb76c1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -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"; diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 92cbc1ba..57a54ed0 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -324,6 +324,8 @@ class SOAPService extends LookupService { onSuccess: (dynamic response, int statusCode) { print("Success"); + episodeID = response["GetEpisodeNo"]; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 79d9c54f..c16c5959 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -444,7 +444,7 @@ class SOAPViewModel extends BaseViewModel { } Future getEpisodeForInpatient(PatiantInformtion patient) async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = GetEpisodeForInpatientReqModel( patientID: patient.patientId, @@ -453,9 +453,12 @@ class SOAPViewModel extends BaseViewModel { await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Error); - } else + setState(ViewState.ErrorLocal); + } else { + patient.episodeNo = _SOAPService.episodeID; setState(ViewState.Idle); + + } } // ignore: missing_return diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index c5bdcd32..86f4a378 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -32,7 +32,8 @@ class PatientProfileScreen extends StatefulWidget { _PatientProfileScreenState createState() => _PatientProfileScreenState(); } -class _PatientProfileScreenState extends State with SingleTickerProviderStateMixin { +class _PatientProfileScreenState extends State + with SingleTickerProviderStateMixin { PatiantInformtion patient; LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); @@ -55,6 +56,7 @@ class _PatientProfileScreenState extends State with Single StreamController videoCallDurationStreamController; Stream videoCallDurationStream = (() async* {})(); + @override void initState() { _tabController = TabController(length: 2, vsync: this); @@ -109,15 +111,17 @@ class _PatientProfileScreenState extends State with Single } StreamSubscription callTimer; + callConnected() { - callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) - ..onDone(() { - callTimer.cancel(); - }) - ..onData((data) { - var t = Helpers.timeFrom(duration: data.elapsed); - videoCallDurationStreamController.sink.add(t); - }); + callTimer = + CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) + ..onDone(() { + callTimer.cancel(); + }) + ..onData((data) { + var t = Helpers.timeFrom(duration: data.elapsed); + videoCallDurationStreamController.sink.add(t); + }); } callDisconnected() { @@ -134,12 +138,11 @@ class _PatientProfileScreenState extends State with Single final screenSize = MediaQuery.of(context).size; return BaseView( 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( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).patientProfile, isShowAppBar: false, body: Column( @@ -148,11 +151,13 @@ class _PatientProfileScreenState extends State with Single children: [ Column( children: [ - PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType, + PatientProfileHeaderNewDesignAppBar( + patient, arrivalType ?? '0', patientType, videoCallDurationStream: videoCallDurationStream, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - height: (patient.patientStatusType != null && patient.patientStatusType == 43) + height: (patient.patientStatusType != null && + patient.patientStatusType == 43) ? 210 : isDischargedPatient ? 240 @@ -184,7 +189,8 @@ class _PatientProfileScreenState extends State with Single isInpatient: isInpatient, from: from, to: to, - isDischargedPatient: isDischargedPatient, + isDischargedPatient: + isDischargedPatient, isFromSearch: isFromSearch, ) : ProfileGridForOther( @@ -205,12 +211,18 @@ class _PatientProfileScreenState extends State with Single ), ], ), - if ( (isInpatient )? true:isFromLiveCare - ? patient.episodeNo != null - : patient.patientStatusType != null && patient.patientStatusType == 43) + if ((isInpatient) + ? true + : isFromLiveCare + ? patient.episodeNo != null + : patient.patientStatusType != null && + patient.patientStatusType == 43) BaseView( onModelReady: (model) async { model.getDoctorProfile(); + if (isInpatient) { + await model.getEpisodeForInpatient(patient); + } }, builder: (_, model, w) => Positioned( top: 180, @@ -219,11 +231,11 @@ class _PatientProfileScreenState extends State with Single child: Row( children: [ Expanded(child: Container()), - if (patient.episodeNo == 0 || isInpatient) + if (patient.episodeNo == 0) AppButton( title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", - color: isFromLiveCare ||isInpatient + color: isFromLiveCare || isInpatient ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 @@ -240,9 +252,11 @@ class _PatientProfileScreenState extends State with Single height: 30, ), onPressed: () async { - if ((isFromLiveCare && patient.appointmentNo != null) || + if ((isFromLiveCare && + patient.appointmentNo != null) || patient.patientStatusType == 43) { - createEpisode(patient:patient, model:model); + createEpisode( + patient: patient, model: model); } }, ), @@ -250,7 +264,7 @@ class _PatientProfileScreenState extends State with Single AppButton( title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: (isInpatient ) || isFromLiveCare + color: (isInpatient) || isFromLiveCare ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 @@ -267,16 +281,19 @@ class _PatientProfileScreenState extends State with Single height: 30, ), onPressed: () async { - await locator().logEvent( + await locator() + .logEvent( eventCategory: "Patient Profile ", eventAction: "Update Episode", ); if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || - patient.patientStatusType == 43 ||isInpatient ) { - Navigator.of(context) - .pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); + patient.patientStatusType == 43 || + isInpatient) { + Navigator.of(context).pushNamed( + UPDATE_EPISODE, + arguments: {'patient': patient}); } }), ], @@ -308,11 +325,14 @@ class _PatientProfileScreenState extends State with Single child: Center( child: AppButton( fontWeight: FontWeight.w700, - color: isCallFinished ? Colors.red[600] : Colors.green[600], + color: isCallFinished + ? Colors.red[600] + : Colors.green[600], title: isCallFinished ? TranslationBase.of(context).endCall : TranslationBase.of(context).initiateCall, - disabled: isCallStarted || model.state == ViewState.BusyLocal, + disabled: isCallStarted || + model.state == ViewState.BusyLocal, onPressed: () async { // TODO MOSA TEST // AppPermissionsUtils @@ -328,37 +348,52 @@ class _PatientProfileScreenState extends State with Single // }); if (isCallFinished) { Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => EndCallScreen(patient: patient),settings: RouteSettings(name: 'EndCallScreen'),),); + context, + MaterialPageRoute( + builder: (BuildContext context) => + EndCallScreen(patient: patient), + settings: + RouteSettings(name: 'EndCallScreen'), + ), + ); } else { GifLoaderDialogUtils.showMyDialog(context); - await model.startCall(isReCall: false, vCID: patient.vcId); + await model.startCall( + isReCall: false, vCID: patient.vcId); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(model.error); } else { await model.getDoctorProfile(); - patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); + patient.appointmentNo = int.parse(model + .startCallRes.appointmentNo + .toString()); patient.episodeNo = 0; model.updateInCallPatient( patient: patient, - appointmentNo: int.parse(model.startCallRes.appointmentNo.toString())); + appointmentNo: int.parse(model + .startCallRes.appointmentNo + .toString())); setState(() { isCallStarted = true; }); GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils.requestVideoCallPermission( - context: context, - onTapGrant: () { - locator().openVideo( - model.startCallRes, - patient, - model.startCallRes != null ? model.startCallRes.isRecording : true, - callConnected, - callDisconnected); - }); + AppPermissionsUtils + .requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo( + model.startCallRes, + patient, + model.startCallRes != null + ? model.startCallRes + .isRecording + : true, + callConnected, + callDisconnected); + }); } } }, @@ -377,21 +412,19 @@ class _PatientProfileScreenState extends State with Single ); } - createEpisode({PatiantInformtion patient, SOAPViewModel model}) async{ + createEpisode({PatiantInformtion patient, SOAPViewModel model}) async { await locator().logEvent( - eventCategory: "Patient Profile", - eventAction: "Create Episode", + 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 - - - ); + if (patient.admissionNo == null || patient.admissionNo.isNotEmpty) { + PostEpisodeForInpatientRequestModel postEpisodeReqModel = + PostEpisodeForInpatientRequestModel( + admissionNo: int.parse(patient.admissionNo), + patientID: patient.patientId); await model.postEpisodeForInPatient(postEpisodeReqModel); - }else{ + } else { PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( appointmentNo: int.parse(patient.appointmentNo.toString()), patientMRN: patient.patientMRN); @@ -400,14 +433,13 @@ class _PatientProfileScreenState extends State with Single } GifLoaderDialogUtils.hideDialog(context); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); - }else{ + } else { patient.episodeNo = model.episodeID; Navigator.of(context) .pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); } - } } @@ -420,7 +452,12 @@ class AvatarWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( 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)), color: Color(0xffCCCCCC), ), From 4c2d55015fa4811bddef384094bb1e9f8205360b Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 5 Sep 2021 15:10:22 +0300 Subject: [PATCH 4/5] add loading --- .../profile_screen/patient_profile_screen.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 86f4a378..03046a8f 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -143,6 +143,7 @@ class _PatientProfileScreenState extends State }, builder: (_, model, w) => AppScaffold( baseViewModel: model, + isLoading: true, appBarTitle: TranslationBase.of(context).patientProfile, isShowAppBar: false, body: Column( @@ -228,11 +229,14 @@ class _PatientProfileScreenState extends State top: 180, left: 20, right: 20, - child: Row( + child: Row( children: [ Expanded(child: Container()), if (patient.episodeNo == 0) AppButton( + loading: model.state== ViewState.BusyLocal, + disabled: model.state== ViewState.BusyLocal, + title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", color: isFromLiveCare || isInpatient @@ -262,9 +266,12 @@ class _PatientProfileScreenState extends State ), if (patient.episodeNo != 0) AppButton( + loading: model.state== ViewState.BusyLocal, + disabled: model.state== ViewState.BusyLocal, + title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: (isInpatient) || isFromLiveCare + color: ((isInpatient) || isFromLiveCare) && model.state!= ViewState.BusyLocal ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 From 5bbb2049cebd2749c4aca1b967d4c98bdde0acf7 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 5 Sep 2021 15:29:07 +0300 Subject: [PATCH 5/5] fix create episode url --- lib/config/config.dart | 2 +- .../profile/profile_screen/patient_profile_screen.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 57bb76c1..7002bc3a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -134,7 +134,7 @@ const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; -const POST_EPISODE_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/PostEpisode'; +const POST_EPISODE_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/PostEpisodeForInpatient'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 03046a8f..5df41821 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -258,7 +258,7 @@ class _PatientProfileScreenState extends State onPressed: () async { if ((isFromLiveCare && patient.appointmentNo != null) || - patient.patientStatusType == 43) { + patient.patientStatusType == 43 || isInpatient ) { createEpisode( patient: patient, model: model); } @@ -425,7 +425,7 @@ class _PatientProfileScreenState extends State eventAction: "Create Episode", ); GifLoaderDialogUtils.showMyDialog(context); - if (patient.admissionNo == null || patient.admissionNo.isNotEmpty) { + if (patient.admissionNo != null && patient.admissionNo.isNotEmpty) { PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel( admissionNo: int.parse(patient.admissionNo),