add the new logic

merge-requests/550/head
Elham Rababah 5 years ago
parent b1951296cd
commit d4ddfa21e5

@ -27,9 +27,9 @@ class RadiologyService extends BaseService {
}, body: body); }, body: body);
} }
Future getPatientRadOrders(PatiantInformtion patient) async { Future getPatientRadOrders(PatiantInformtion patient , {isInPatient = false}) async {
String url = GET_PATIENT_ORDERS; String url = GET_PATIENT_ORDERS;
if(patient.patientType == 1) { if(isInPatient) {
url = GET_IN_PATIENT_ORDERS; url = GET_IN_PATIENT_ORDERS;
} }
hasError = false; hasError = false;
@ -38,7 +38,7 @@ class RadiologyService extends BaseService {
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
finalRadiologyList.clear(); finalRadiologyList.clear();
String label = "ListRAD"; String label = "ListRAD";
if(patient.patientType == 1) { if(isInPatient) {
label ="List_GetRadOreders"; label ="List_GetRadOreders";
} }
response[label].forEach((radiology) { response[label].forEach((radiology) {

@ -137,11 +137,12 @@ class ProcedureViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
//await getProcedure(mrn: mrn); //await getProcedure(mrn: mrn);
} }
void getPatientRadOrders(PatiantInformtion patient,{String patientType}) async { void getPatientRadOrders(PatiantInformtion patient,{String patientType, bool isInPatient = false}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders(patient); await _radiologyService.getPatientRadOrders(patient, isInPatient:isInPatient);
if (_radiologyService.hasError) { if (_radiologyService.hasError) {
error = _radiologyService.error; error = _radiologyService.error;
if(patientType=="7") if(patientType=="7")

@ -20,9 +20,9 @@ class RadiologyViewModel extends BaseViewModel {
? _finalRadiologyListClinic ? _finalRadiologyListClinic
: _finalRadiologyListHospital; : _finalRadiologyListHospital;
void getPatientRadOrders(PatiantInformtion patient) async { void getPatientRadOrders(PatiantInformtion patient, {isInPatient = false}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders(patient); await _radiologyService.getPatientRadOrders(patient, isInPatient:isInPatient);
if (_radiologyService.hasError) { if (_radiologyService.hasError) {
error = _radiologyService.error; error = _radiologyService.error;
setState(ViewState.Error); setState(ViewState.Error);

@ -644,6 +644,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
isSearch, isSearch,
"arrivalType": "arrivalType":
arrivalType, arrivalType,
"isInpatient":isInpatient
}); });
}, },
); );

@ -26,6 +26,7 @@ import '../../../routes.dart';
class PatientProfileScreen extends StatelessWidget { class PatientProfileScreen extends StatelessWidget {
PatiantInformtion patient; PatiantInformtion patient;
bool isFromSearch = false; bool isFromSearch = false;
bool isInpatient = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,52 +40,10 @@ class PatientProfileScreen extends StatelessWidget {
String to = routeArgs['to']; String to = routeArgs['to'];
if (routeArgs.containsKey("isSearch")) { if (routeArgs.containsKey("isSearch")) {
isFromSearch = routeArgs['isSearch']; isFromSearch = routeArgs['isSearch'];
isInpatient = routeArgs['isInpatient'];
} }
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
onModelReady: (patientViewModel) async {
PatientModel patientReq = PatientModel(
ProjectID: 0,
ClinicID: 0,
DoctorID: 0,
FirstName: "0",
MiddleName: "0",
LastName: "0",
PatientMobileNumber: "0",
PatientIdentificationID: "0",
PatientID: patient.patientId,
From: "0",
To: "0",
LanguageID: 2,
stamp: "2020-03-02T13:56:39.170Z",
IPAdress: "11.11.11.11",
VersionID: 1.2,
Channel: 9,
TokenID: "@dm!n",
SessionID: "5G0yXn0Jnq",
IsLoginForDoctorApp: true,
PatientOutSA: false);
if (patientType == "1" &&
(patient.admissionNo == null ||
patient.admissionNo == "0")) {
patientViewModel
.getPatientList(patientReq, "1", isBusyLocal: false)
.then((response) {
if (response['MessageStatus'] == 1) {
if (response['List_MyInPatient'] != null) {
List<PatiantInformtion> patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
patient.admissionNo = patientList[0].admissionNo;
patient.admissionDate = patientList[0].admissionDate;
} else {
DrAppToastMsg.showErrorToast('No patient');
}
}
}).catchError((error) {
print(error);
});
}
},
builder: (_, patientViewModel, w) => AppScaffold( builder: (_, patientViewModel, w) => AppScaffold(
baseViewModel: patientViewModel, baseViewModel: patientViewModel,
appBarTitle: TranslationBase.of(context).patientProfile, appBarTitle: TranslationBase.of(context).patientProfile,
@ -115,21 +74,27 @@ class PatientProfileScreen extends StatelessWidget {
arrivalType: arrivalType, arrivalType: arrivalType,
from: from, from: from,
to: to, to: to,
isInpatient:false
// isFromSearch:isFromSearch
) )
: patientType == "1" : isInpatient
? ProfileMedicalInfoWidgetInPatient( ? ProfileMedicalInfoWidgetInPatient(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
from: from, from: from,
to: to, to: to,
) isInpatient:isInpatient,
)
: ProfileMedicalInfoWidget( : ProfileMedicalInfoWidget(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
from: from, from: from,
to: to, to: to,
isInpatient:isInpatient
), ),
], ],
), ),

@ -28,9 +28,10 @@ class RadiologyHomePage extends StatelessWidget {
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getPatientRadOrders(patient,patientType: patientType), onModelReady: (model) => model.getPatientRadOrders(patient,patientType: patientType, isInPatient: isInpatient),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],

@ -18,6 +18,7 @@ class PatientProfileButton extends StatelessWidget {
final String url = "assets/images/"; final String url = "assets/images/";
final bool isDisable; final bool isDisable;
final bool isLoading; final bool isLoading;
final bool isInpatient;
final Function onTap; final Function onTap;
PatientProfileButton( PatientProfileButton(
@ -33,7 +34,7 @@ class PatientProfileButton extends StatelessWidget {
this.onTap, this.onTap,
this.isLoading = false, this.isLoading = false,
this.from, this.from,
this.to}) this.to, this.isInpatient})
: super(key: key); : super(key: key);
@override @override
@ -127,7 +128,8 @@ class PatientProfileButton extends StatelessWidget {
'from': from, 'from': from,
'to': to, 'to': to,
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType 'arrivalType': arrivalType,
'isInpatient':isInpatient
}); });
} }
} }

@ -22,6 +22,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
final bool isInpatient;
ProfileMedicalInfoWidget( ProfileMedicalInfoWidget(
{Key key, {Key key,
@ -29,7 +30,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
this.patientType, this.patientType,
this.arrivalType, this.arrivalType,
this.from, this.from,
this.to}); this.to, this.isInpatient});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -80,6 +81,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
isInpatient:isInpatient,
route: RADIOLOGY_PATIENT, route: RADIOLOGY_PATIENT,
nameLine1: TranslationBase.of(context).radiology, nameLine1: TranslationBase.of(context).radiology,
nameLine2: TranslationBase.of(context).service, nameLine2: TranslationBase.of(context).service,
@ -165,7 +167,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).admission, nameLine1: TranslationBase.of(context).admission,
nameLine2: TranslationBase.of(context).request, nameLine2: TranslationBase.of(context).request,
icon: 'patient/admission_req.png'), icon: 'patient/admission_req.png'),
if (patientType == "1") if (isInpatient)
PatientProfileButton( PatientProfileButton(
key: key, key: key,
patient: patient, patient: patient,
@ -175,7 +177,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).progress, nameLine1: TranslationBase.of(context).progress,
nameLine2: TranslationBase.of(context).note, nameLine2: TranslationBase.of(context).note,
icon: 'patient/Progress_notes.png'), icon: 'patient/Progress_notes.png'),
if (patientType == "1") if (isInpatient)
PatientProfileButton( PatientProfileButton(
key: key, key: key,
patient: patient, patient: patient,

@ -22,6 +22,9 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
final bool isInpatient;
ProfileMedicalInfoWidgetInPatient( ProfileMedicalInfoWidgetInPatient(
{Key key, {Key key,
@ -29,7 +32,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
this.patientType, this.patientType,
this.arrivalType, this.arrivalType,
this.from, this.from,
this.to}); this.to, this.isInpatient});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -68,6 +71,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
isInpatient: isInpatient,
route: RADIOLOGY_PATIENT, route: RADIOLOGY_PATIENT,
nameLine1: TranslationBase.of(context).radiology, nameLine1: TranslationBase.of(context).radiology,
nameLine2: TranslationBase.of(context).result, nameLine2: TranslationBase.of(context).result,

@ -13,6 +13,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
final bool isInpatient;
ProfileMedicalInfoWidgetSearch( ProfileMedicalInfoWidgetSearch(
{Key key, {Key key,
@ -20,7 +21,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget {
this.patientType, this.patientType,
this.arrivalType, this.arrivalType,
this.from, this.from,
this.to}); this.to, this.isInpatient});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -68,6 +69,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget {
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
isInpatient:isInpatient,
route: RADIOLOGY_PATIENT, route: RADIOLOGY_PATIENT,
nameLine1: TranslationBase.of(context).radiology, nameLine1: TranslationBase.of(context).radiology,
nameLine2: TranslationBase.of(context).service, nameLine2: TranslationBase.of(context).service,

Loading…
Cancel
Save