first step from create episode inpatint

merge-requests/816/head
Elham Rababh 3 years ago
parent 5a91f6a25b
commit df40a2dc09

@ -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';

@ -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;

@ -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);

@ -0,0 +1,22 @@
class PostEpisodeForInpatientRequestModel {
int admissionNo;
int patientID;
int patientTypeID;
PostEpisodeForInpatientRequestModel(
{this.admissionNo, this.patientID, this.patientTypeID = 1});
PostEpisodeForInpatientRequestModel.fromJson(Map<String, dynamic> json) {
admissionNo = json['AdmissionNo'];
patientID = json['PatientID'];
patientTypeID = json['PatientTypeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AdmissionNo'] = this.admissionNo;
data['PatientID'] = this.patientID;
data['PatientTypeID'] = this.patientTypeID;
return data;
}
}

@ -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 {

Loading…
Cancel
Save