re-design UCAF to pager

merge-requests/824/head
mosazaid 4 years ago
parent c608b5601d
commit aae1cba405

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

@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel {
List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList;
Function saveUCAFOnTap;
String selectedLanguage;
String heightCm = "0";
String weightKg = "0";
@ -56,7 +58,7 @@ class UcafViewModel extends BaseViewModel {
}
Future getUCAFData(PatiantInformtion patient) async {
setState(ViewState.Busy);
// setState(ViewState.Busy);
String from;
String to;
@ -112,7 +114,7 @@ class UcafViewModel extends BaseViewModel {
Future getPatientAssessment(PatiantInformtion patient) async {
if (patientAssessmentList.isEmpty) {
setState(ViewState.Busy);
// setState(ViewState.Busy);
await _ucafService.getPatientAssessment(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
@ -139,7 +141,7 @@ class UcafViewModel extends BaseViewModel {
Future getOrderProcedures(PatiantInformtion patient) async {
if (orderProcedures.isEmpty) {
setState(ViewState.Busy);
// setState(ViewState.Busy);
await _ucafService.getOrderProcedures(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
@ -152,7 +154,7 @@ class UcafViewModel extends BaseViewModel {
Future getPrescription(PatiantInformtion patient) async {
if (prescriptionList == null) {
setState(ViewState.Busy);
// setState(ViewState.Busy);
await _ucafService.getPrescription(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
@ -190,7 +192,7 @@ class UcafViewModel extends BaseViewModel {
}
Future postUCAF(PatiantInformtion patient) async {
setState(ViewState.Busy);
// setState(ViewState.Busy);
await _ucafService.postUCAF(patient);
if (_ucafService.hasError) {
error = _ucafService.error;

@ -3,8 +3,6 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart';
import 'package:doctor_app_flutter/screens/patients/ECGPage.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart';
@ -22,6 +20,7 @@ import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart';
import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart';
import './screens/auth/login_screen.dart';
import 'screens/patients/profile/UCAF/ucaf_pager_screen.dart';
import 'screens/patients/profile/profile_screen/patient_profile_screen.dart';
import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart';
import 'landing_page.dart';
@ -109,8 +108,8 @@ var routes = {
ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(),
ORDER_PROCEDURE: (_) => ProcedureScreen(),
MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(),
PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(),
PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(),
PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(),
// PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(),
PATIENT_ECG: (_) => ECGPage(),
ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(),
};

@ -100,6 +100,7 @@ class _InPatientPageState extends State<InPatientPage> {
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: SingleChildScrollView(
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListView.builder(
@ -118,15 +119,15 @@ class _InPatientPageState extends State<InPatientPage> {
arrivalType: "1",
isInpatient: true,
isMyPatient: widget
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget.patientSearchViewModel
.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
FocusScope.of(context);
if (!currentFocus
.hasPrimaryFocus) {
currentFocus.unfocus();
@ -145,10 +146,10 @@ class _InPatientPageState extends State<InPatientPage> {
"isInpatient": true,
"arrivalType": "1",
"isMyPatient": widget
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget
.patientSearchViewModel
.doctorProfile
@ -157,12 +158,12 @@ class _InPatientPageState extends State<InPatientPage> {
},
);
else if (widget
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget.patientSearchViewModel
.doctorProfile.doctorID &&
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget.patientSearchViewModel
.doctorProfile.doctorID &&
widget.isMyInPatient)
return PatientCard(
patientInfo: widget
@ -172,15 +173,15 @@ class _InPatientPageState extends State<InPatientPage> {
arrivalType: "1",
isInpatient: true,
isMyPatient: widget
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget.patientSearchViewModel
.doctorProfile.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
FocusScope.of(context);
if (!currentFocus
.hasPrimaryFocus) {
currentFocus.unfocus();
@ -199,10 +200,10 @@ class _InPatientPageState extends State<InPatientPage> {
"isInpatient": true,
"arrivalType": "1",
"isMyPatient": widget
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
.patientSearchViewModel
.filteredInPatientItems[
index]
.doctorId ==
widget
.patientSearchViewModel
.doctorProfile
@ -222,12 +223,7 @@ class _InPatientPageState extends State<InPatientPage> {
),
)
: NoData()
: Center(
child: Container(
height: 300,
width: 300,
),
),
: NoData(),
],
),
);

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/order-procedure.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/patients/profile/UCAF/page-stepper-widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/ucaf_pager_screen.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -22,33 +23,63 @@ import 'package:hexcolor/hexcolor.dart';
import '../../../../routes.dart';
class UcafDetailScreen extends StatefulWidget {
final PatiantInformtion patient;
final UcafViewModel model;
final Function changeLoadingState;
UcafDetailScreen(this.patient, this.model, {this.changeLoadingState});
@override
_UcafDetailScreenState createState() => _UcafDetailScreenState();
_UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model);
}
class _UcafDetailScreenState extends State<UcafDetailScreen> {
final PatiantInformtion patient;
final UcafViewModel model;
UcafViewModel ucafModel;
int _activeTap = 0;
_UcafDetailScreenState(this.patient, this.model);
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
void initState() {
model.saveUCAFOnTap = () async{
widget.changeLoadingState(true);
await ucafModel.postUCAF(patient);
widget.changeLoadingState(false);
if (ucafModel.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.postUcafSuccessMsg);
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(ucafModel.error);
}
};
super.initState();
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>(
onModelReady: (model) async {
ucafModel = model;
model.resetDataInFirst();
await model.getLanguage();
await model.getPatientAssessment(patient);
widget.changeLoadingState(false);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileAppBar(patient),
appBarTitle: TranslationBase.of(context).ucaf,
isShowAppBar: false,
body: Column(
children: [
Expanded(
@ -57,35 +88,6 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: 2,
screenSize: screenSize,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
@ -106,64 +108,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
),
),
),
Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Colors.white,
color: Colors.white,
fontColor: HexColor("#B8382B"),
fontSize: 2.2,
onPressed: () {
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).save,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: HexColor("#B8382B"),
color: HexColor("#B8382B"),
fontColor: Colors.white,
fontSize: 2.0,
onPressed: () async {
await model.postUCAF(patient);
if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.postUcafSuccessMsg);
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(model.error);
}
},
),
),
),
],
),
),
],
),
));
@ -209,12 +154,18 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
onTap: () async {
print(__treatmentSteps.indexOf(item));
if (__treatmentSteps.indexOf(item) == 0) {
widget.changeLoadingState(true);
await model.getPatientAssessment(patient);
widget.changeLoadingState(false);
} else if (__treatmentSteps.indexOf(item) == 1) {
widget.changeLoadingState(true);
await model.getPrescription(patient);
widget.changeLoadingState(false);
}
if (__treatmentSteps.indexOf(item) == 2) {
widget.changeLoadingState(true);
await model.getOrderProcedures(patient);
widget.changeLoadingState(false);
}
setState(() {
_activeTap = __treatmentSteps.indexOf(item);
@ -288,6 +239,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
];
}
}
}
class DiagnosisWidget extends StatelessWidget {

@ -19,11 +19,20 @@ import 'package:hexcolor/hexcolor.dart';
import '../../../../routes.dart';
class UCAFInputScreen extends StatefulWidget {
final PatiantInformtion patient;
final Function changeLoadingState;
UCAFInputScreen(this.patient, {this.changeLoadingState});
@override
_UCAFInputScreenState createState() => _UCAFInputScreenState();
_UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient);
}
class _UCAFInputScreenState extends State<UCAFInputScreen> {
final PatiantInformtion patient;
_UCAFInputScreenState(this.patient);
bool _inPatient = false;
bool _emergencyCase = false;
final _durationOfIllnessController = TextEditingController();
@ -53,21 +62,15 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>(
onModelReady: (model) => model.getUCAFData(patient),
onModelReady: (model) async {
// widget.changeLoadingState(true);
await model.getUCAFData(patient);
widget.changeLoadingState(false);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileAppBar(
patient),
appBarTitle: TranslationBase.of(context).ucaf,
isShowAppBar: false,
body: model.patientVitalSignsHistory.length > 0 &&
model.patientChiefComplaintList != null &&
model.patientChiefComplaintList.length > 0
@ -79,31 +82,6 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: 1,
screenSize: screenSize,
),
Container(
margin: EdgeInsets.symmetric(
vertical: 0, horizontal: 16),
@ -263,7 +241,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
fontWeight: FontWeight.w700,
color: Color(0xFF2E303A),
),
/* SizedBox(
/* SizedBox(
height: 4,
),
AppText(
@ -323,7 +301,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
SizedBox(
height: 8,
),
/* AppTextFieldCustom(
/* AppTextFieldCustom(
hintText: TranslationBase.of(context).other,
dropDownText: TranslationBase.of(context).none,
enabled: false,
@ -400,21 +378,6 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton(
title: TranslationBase.of(context).next,
color: HexColor("#D02127"),
onPressed: () {
Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType
});
},
),
),
],
)
: Center(
@ -428,9 +391,10 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg,
model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context)
.chiefComplaintEmptyMsg,
fontWeight: FontWeight.normal,
textAlign: TextAlign.center,
color: HexColor("#B8382B"),

@ -0,0 +1,214 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/patients/profile/UCAF/page-stepper-widget.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart';
import '../../../../routes.dart';
import 'UCAF-detail-screen.dart';
import 'UCAF-input-screen.dart';
class UCAFPagerScreen extends StatefulWidget {
const UCAFPagerScreen({Key key}) : super(key: key);
@override
_UCAFPagerScreenState createState() => _UCAFPagerScreenState();
}
class _UCAFPagerScreenState extends State<UCAFPagerScreen>
with TickerProviderStateMixin {
PageController _controller;
int _currentIndex = 0;
bool _isLoading = true;
PatiantInformtion patient;
String patientType;
String arrivalType;
changePageViewIndex(pageIndex, {isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
_controller.jumpToPage(pageIndex);
setState(() {
_currentIndex = pageIndex;
});
}
void changeLoadingState(bool isLoading) {
setState(() {
_isLoading = isLoading;
});
}
@override
void initState() {
_controller = new PageController();
super.initState();
}
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
isLoading: _isLoading,
appBar: PatientProfileAppBar(patient),
appBarTitle: TranslationBase.of(context).ucaf,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: _currentIndex + 1,
screenSize: screenSize,
),
SizedBox(
height: 10,
),
Expanded(
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
UCAFInputScreen(
patient,
changeLoadingState: changeLoadingState,
),
UcafDetailScreen(
patient,
model,
changeLoadingState: changeLoadingState,
),
]),
),
),
],
),
),
),
_isLoading
? Container(
height: 0,
)
: ucafButtons(model),
],
),
));
}
Widget ucafButtons(UcafViewModel model) {
switch (_currentIndex) {
case 0:
return Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton(
title: TranslationBase.of(context).next,
color: Color(0xFFD02127),
onPressed: () {
changePageViewIndex(1);
// Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {
// 'patient': patient,
// 'patientType': patientType,
// 'arrivalType': arrivalType
// });
},
),
);
case 1:
return Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Colors.white,
color: Colors.white,
fontColor: Color(0xFFB8382B),
fontSize: 2.2,
onPressed: () {
Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE;
});
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).save,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Color(0xFFB8382B),
color: Color(0xFFB8382B),
fontColor: Colors.white,
fontSize: 2.0,
onPressed: () {
model.saveUCAFOnTap();
},
),
),
),
],
),
);
default:
return Container();
}
}
}
Loading…
Cancel
Save