|
|
@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../locator.dart';
|
|
|
|
import '../../locator.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -40,8 +42,8 @@ class PatientReferralViewModel extends BaseViewModel {
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
setState(ViewState.Error);
|
|
|
|
setState(ViewState.Error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(patientReferral.length == 0){
|
|
|
|
if (patientReferral.length == 0) {
|
|
|
|
await getMasterLookup(MasterKeysService.physiotherapyGoals);
|
|
|
|
await getMasterLookup(MasterKeysService.physiotherapyGoals);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -126,7 +128,8 @@ class PatientReferralViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async {
|
|
|
|
Future responseReferral(
|
|
|
|
|
|
|
|
PendingReferral pendingReferral, bool isAccepted) async {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
await _referralPatientService.responseReferral(pendingReferral, isAccepted);
|
|
|
|
await _referralPatientService.responseReferral(pendingReferral, isAccepted);
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
@ -136,14 +139,11 @@ class PatientReferralViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future makeReferral(PatiantInformtion patient,
|
|
|
|
Future makeReferral(PatiantInformtion patient, String isoStringDate,
|
|
|
|
String isoStringDate,
|
|
|
|
int projectID, int clinicID, int doctorID, String remarks) async {
|
|
|
|
int projectID,
|
|
|
|
|
|
|
|
int clinicID,
|
|
|
|
|
|
|
|
int doctorID,
|
|
|
|
|
|
|
|
String remarks) async {
|
|
|
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks);
|
|
|
|
await _referralPatientService.makeReferral(
|
|
|
|
|
|
|
|
patient, isoStringDate, projectID, clinicID, doctorID, remarks);
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
setState(ViewState.Error);
|
|
|
|
setState(ViewState.Error);
|
|
|
@ -152,18 +152,40 @@ class PatientReferralViewModel extends BaseViewModel {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async {
|
|
|
|
Future getPatientDetails(
|
|
|
|
|
|
|
|
String fromDate, String toDate, int patientMrn, int appointmentNo) async {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
|
|
|
|
|
|
|
await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn, appointmentNo: appointmentNo);
|
|
|
|
await _referralPatientService.getPatientArrivalList(toDate,
|
|
|
|
|
|
|
|
fromDate: fromDate,
|
|
|
|
|
|
|
|
patientMrn: patientMrn,
|
|
|
|
|
|
|
|
appointmentNo: appointmentNo);
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
|
if (_referralPatientService.hasError) {
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
error = _referralPatientService.error;
|
|
|
|
setState(ViewState.Error);
|
|
|
|
setState(ViewState.Error);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* model
|
|
|
|
* model
|
|
|
|
.getPatientArrivalList()*/
|
|
|
|
.getPatientArrivalList()*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String getReferralStatusNameByCode(int statusCode, BuildContext context) {
|
|
|
|
|
|
|
|
switch (statusCode) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
return TranslationBase.of(context).referralStatusHold;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
return TranslationBase.of(context).referralStatusActive;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
return TranslationBase.of(context).referralStatusCancelled;
|
|
|
|
|
|
|
|
case 46:
|
|
|
|
|
|
|
|
return TranslationBase.of(context).referralStatusCompleted;
|
|
|
|
|
|
|
|
case 63:
|
|
|
|
|
|
|
|
return TranslationBase.of(context).referralStatusNotSeen;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return "-";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|