|
|
|
|
@ -19,6 +19,8 @@ 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';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart';
|
|
|
|
|
@ -89,56 +91,64 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
List<GetAssessmentResModel> 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<GetMedicationResponseModel> 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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -176,6 +186,19 @@ 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);
|
|
|
|
|
@ -361,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);
|
|
|
|
|
@ -417,6 +443,23 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getEpisodeForInpatient(PatiantInformtion patient) async {
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
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.ErrorLocal);
|
|
|
|
|
} else {
|
|
|
|
|
patient.episodeNo = _SOAPService.episodeID;
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ignore: missing_return
|
|
|
|
|
MasterKeyModel getOneMasterKey(
|
|
|
|
|
{@required MasterKeysService masterKeys, dynamic id, int typeId}) {
|
|
|
|
|
@ -530,14 +573,268 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int getFirstIndexForOldExamination(List<MySelectedExamination> mySelectedExamination){
|
|
|
|
|
Iterable<MySelectedExamination> examList = mySelectedExamination.where(
|
|
|
|
|
(element) => !element.isLocal);
|
|
|
|
|
int getFirstIndexForOldExamination(
|
|
|
|
|
List<MySelectedExamination> mySelectedExamination) {
|
|
|
|
|
Iterable<MySelectedExamination> examList =
|
|
|
|
|
mySelectedExamination.where((element) => !element.isLocal);
|
|
|
|
|
|
|
|
|
|
if (examList.length > 0) {
|
|
|
|
|
return mySelectedExamination.indexOf(examList.first);
|
|
|
|
|
} else
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUpdateSubjectStepStart(PatiantInformtion patientInfo) async {
|
|
|
|
|
GetChiefComplaintReqModel getChiefComplaintReqModel =
|
|
|
|
|
GetChiefComplaintReqModel(
|
|
|
|
|
admissionNo:
|
|
|
|
|
patientInfo
|
|
|
|
|
.admissionNo !=
|
|
|
|
|
null
|
|
|
|
|
? int.parse(patientInfo.admissionNo)
|
|
|
|
|
: null,
|
|
|
|
|
patientMRN: patientInfo.patientMRN,
|
|
|
|
|
appointmentNo: patientInfo.appointmentNo != null
|
|
|
|
|
? int.parse(patientInfo.appointmentNo.toString())
|
|
|
|
|
: null,
|
|
|
|
|
episodeId: patientInfo.episodeNo,
|
|
|
|
|
episodeID: patientInfo.episodeNo,
|
|
|
|
|
doctorID: '');
|
|
|
|
|
var services = [
|
|
|
|
|
_SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (patientInfo.admissionNo == null) {
|
|
|
|
|
complaintsControllerError = '';
|
|
|
|
|
medicationControllerError = '';
|
|
|
|
|
illnessControllerError = '';
|
|
|
|
|
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel(
|
|
|
|
|
patientMRN: patientInfo.patientMRN,
|
|
|
|
|
episodeID: patientInfo.episodeNo.toString(),
|
|
|
|
|
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
|
|
|
|
|
doctorID: '',
|
|
|
|
|
editedBy: '');
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true));
|
|
|
|
|
|
|
|
|
|
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
|
|
|
|
|
patientMRN: patientInfo.patientMRN,
|
|
|
|
|
episodeId: patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
|
|
|
|
|
doctorID: '',
|
|
|
|
|
editedBy: '');
|
|
|
|
|
|
|
|
|
|
services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services);
|
|
|
|
|
await callServicesAfterGetPatientInfoForUpdateSubject();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callServicesAfterGetPatientInfoForUpdateSubject() async {
|
|
|
|
|
var services;
|
|
|
|
|
if (patientHistoryList.isNotEmpty) {
|
|
|
|
|
if (historyFamilyList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (historyMedicalList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)
|
|
|
|
|
];
|
|
|
|
|
} else
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical));
|
|
|
|
|
}
|
|
|
|
|
if (historySurgicalList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)
|
|
|
|
|
];
|
|
|
|
|
} else
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical));
|
|
|
|
|
}
|
|
|
|
|
if (historySportList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistorySports)
|
|
|
|
|
];
|
|
|
|
|
} else
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.HistorySports));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (patientAllergiesList.isNotEmpty) {
|
|
|
|
|
if (allergiesList.isEmpty) if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.Allergies)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies));
|
|
|
|
|
if (allergySeverityList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)
|
|
|
|
|
];
|
|
|
|
|
} else
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services ?? []);
|
|
|
|
|
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
setState(ViewState.Error);
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAddMedicationStart() async {
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
var services;
|
|
|
|
|
if (medicationStrengthList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationFrequencyList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(
|
|
|
|
|
MasterKeysService.MedicationFrequency));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationDoseTimeList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationRouteList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (allMedicationList.length == 0) {
|
|
|
|
|
await getMedicationList();
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_prescriptionService.getMedicationList()
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_prescriptionService.getMedicationList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services ?? []);
|
|
|
|
|
|
|
|
|
|
if (_SOAPService.hasError ||_prescriptionService.hasError ) {
|
|
|
|
|
error = _SOAPService.error + _prescriptionService.error;
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callAddAssessmentLookupsServices({bool allowSetState = true}) async {
|
|
|
|
|
if(allowSetState)
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
var services;
|
|
|
|
|
if (listOfDiagnosisCondition.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (listOfDiagnosisType.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(
|
|
|
|
|
MasterKeysService.DiagnosisType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (listOfICD10.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.ICD10)
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(
|
|
|
|
|
_SOAPService.getMasterLookup(MasterKeysService.ICD10));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services ?? []);
|
|
|
|
|
if(allowSetState) {
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async {
|
|
|
|
|
|
|
|
|
|
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
|
|
|
|
|
patientMRN: patientInfo.patientMRN,
|
|
|
|
|
episodeID: patientInfo.episodeNo.toString(),
|
|
|
|
|
editedBy: '',
|
|
|
|
|
doctorID: '',
|
|
|
|
|
appointmentNo:
|
|
|
|
|
int.parse(patientInfo.appointmentNo.toString()));
|
|
|
|
|
|
|
|
|
|
var services = [
|
|
|
|
|
_SOAPService.getPatientAssessment(getAssessmentReqModel)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (patientAssessmentList.isNotEmpty) {
|
|
|
|
|
await callAddAssessmentLookupsServices(allowSetState: false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|