diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart index f38294b5..f89c66da 100644 --- a/lib/core/service/labs_service.dart +++ b/lib/core/service/labs_service.dart @@ -28,7 +28,7 @@ class LabsService extends BaseService { await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { - patientLabOrdersList.clear(); + patientLabOrdersList=[]; if (!isInpatient) { response['ListPLO'].forEach((hospital) { patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 02765c20..3dc771f5 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -12,18 +12,30 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class LabsHomePage extends StatelessWidget { +class LabsHomePage extends StatefulWidget { + @override + _LabsHomePageState createState() => _LabsHomePageState(); +} + +class _LabsHomePageState extends State { String patientType; + String arrivalType; + PatiantInformtion patient; + bool isInpatient; @override - Widget build(BuildContext context) { + void didChangeDependencies() { + super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; - - PatiantInformtion patient = routeArgs['patient']; + patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; - bool isInpatient = routeArgs['isInpatient']; + isInpatient = routeArgs['isInpatient']; print(arrivalType); + } + + @override + Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getLabs(patient, isInpatient: isInpatient), builder: (context, ProcedureViewModel model, widget) => AppScaffold( @@ -93,6 +105,42 @@ class LabsHomePage extends StatelessWidget { )), ); },label: 'Apply for New Lab Order',), + if(!isInpatient) + Container( + margin: EdgeInsets.only(right: 8), + width: double.maxFinite, + child: InkWell( + onTap: (){ + setState(() { + isInpatient= true; + }); + model.getLabs(patient, isInpatient: true); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Inpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), + if(isInpatient) + Container( + width: double.maxFinite, + margin: EdgeInsets.only(right: 8), + child: InkWell( + onTap: (){ + setState(() { + isInpatient= false; + }); + model.getLabs(patient, isInpatient: false); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Outpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), ...List.generate( model.patientLabOrdersList.length, (index) => Column( diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 90d22369..ec34bcd1 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -14,16 +14,29 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class RadiologyHomePage extends StatelessWidget { +class RadiologyHomePage extends StatefulWidget { @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + _RadiologyHomePageState createState() => _RadiologyHomePageState(); +} + +class _RadiologyHomePageState extends State { + String patientType; + PatiantInformtion patient; + String arrivalType; + bool isInpatient; + @override + void didChangeDependencies() { + super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; - bool isInpatient = routeArgs['isInpatient']; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + isInpatient = routeArgs['isInpatient']; + print(arrivalType); + } + @override + Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPatientRadOrders(patient, patientType: patientType, isInPatient: isInpatient), @@ -99,6 +112,42 @@ class RadiologyHomePage extends StatelessWidget { }, label: 'Apply for Radiology Order', ), + if(!isInpatient) + Container( + width: double.maxFinite, + margin: EdgeInsets.only(right: 8), + child: InkWell( + onTap: (){ + setState(() { + isInpatient = true; + }); + model.getPatientRadOrders(patient, patientType: patientType, isInPatient: true); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Inpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), + if(isInpatient) + Container( + margin: EdgeInsets.only(right: 8), + width: double.maxFinite, + child: InkWell( + onTap: (){ + setState(() { + isInpatient = false; + }); + model.getPatientRadOrders(patient, patientType: patientType, isInPatient: false); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Outpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), ...List.generate( model.radiologyList.length, (index) => InkWell( diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index d8d5a928..74acff8a 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -121,16 +121,14 @@ class _AppTextState extends State { style: widget.style != null ? _getFontStyle().copyWith( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null ? widget.color : null, + color: widget.color , fontWeight: widget.fontWeight ?? _getFontWeight(), ) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.textDecoration == null - ? widget.color != null - ? widget.color - : Colors.black - : null, + color: widget.color != null + ? widget.color + : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1.5 : null,