From b707857526416e0b5ce49304b6a2d26021aaa477 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 5 Sep 2021 10:48:55 +0300 Subject: [PATCH] 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; + } +}