first step from procedures

merge-requests/994/head
Elham Rababh 4 years ago
parent 379bfd5bb3
commit 70573d190a

@ -1,18 +1,18 @@
class ProcedureValadteRequestModel { class ProcedureValidationRequestModel {
String vidaAuthTokenID; String vidaAuthTokenID;
int patientMRN; int patientMRN;
int appointmentNo; int appointmentNo;
int episodeID; int episodeID;
List<String> procedure; List<String> procedure;
ProcedureValadteRequestModel( ProcedureValidationRequestModel(
{this.vidaAuthTokenID, {this.vidaAuthTokenID,
this.patientMRN, this.patientMRN,
this.appointmentNo, this.appointmentNo,
this.episodeID, this.episodeID,
this.procedure}); this.procedure});
ProcedureValadteRequestModel.fromJson(Map<String, dynamic> json) { ProcedureValidationRequestModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
patientMRN = json['PatientMRN']; patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo']; appointmentNo = json['AppointmentNo'];

@ -183,8 +183,8 @@ class ProcedureService extends BaseService {
}, body: updateProcedureRequestModel.toJson()); }, body: updateProcedureRequestModel.toJson());
} }
Future valadteProcedure( Future validationProcedure(
ProcedureValadteRequestModel procedureValadteRequestModel) async { ProcedureValidationRequestModel validationProcedureRequestModel) async {
hasError = false; hasError = false;
_valadteProcedureList.clear(); _valadteProcedureList.clear();
await baseAppClient.post(GET_PROCEDURE_VALIDATION, await baseAppClient.post(GET_PROCEDURE_VALIDATION,
@ -194,6 +194,6 @@ class ProcedureService extends BaseService {
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: procedureValadteRequestModel.toJson()); }, body: validationProcedureRequestModel.toJson());
} }
} }

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/labs/lab_order_result.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_order_result.dart';
@ -167,9 +168,9 @@ class ProcedureViewModel extends BaseViewModel {
} }
Future postProcedure( Future postProcedure(
PostProcedureReqModel postProcedureReqModel, int mrn) async { PostProcedureReqModel postProcedureReqModel, int mrn, {bool isLocalBusy = false}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); if(isLocalBusy) setState(ViewState.BusyLocal); else
setState(ViewState.Busy); setState(ViewState.Busy);
await _procedureService.postProcedure(postProcedureReqModel); await _procedureService.postProcedure(postProcedureReqModel);
if (_procedureService.hasError) { if (_procedureService.hasError) {
@ -181,12 +182,12 @@ class ProcedureViewModel extends BaseViewModel {
} }
} }
Future valadteProcedure( Future validationProcedure(
ProcedureValadteRequestModel procedureValadteRequestModel) async { ProcedureValidationRequestModel procedureValadteRequestModel) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _procedureService.valadteProcedure(procedureValadteRequestModel); await _procedureService.validationProcedure(procedureValadteRequestModel);
if (_procedureService.hasError) { if (_procedureService.hasError) {
error = _procedureService.error; error = _procedureService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -381,8 +382,8 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
ProcedureValadteRequestModel procedureValadteRequestModel = ProcedureValidationRequestModel procedureValadteRequestModel =
new ProcedureValadteRequestModel(); new ProcedureValidationRequestModel();
procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.patientMRN = patient.patientMRN;
procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.episodeID = patient.episodeNo;
procedureValadteRequestModel.appointmentNo = patient.appointmentNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
@ -415,16 +416,20 @@ class ProcedureViewModel extends BaseViewModel {
}); });
postProcedureReqModel.procedures = controlsProcedure; postProcedureReqModel.procedures = controlsProcedure;
await valadteProcedure(procedureValadteRequestModel); await validationProcedure(procedureValadteRequestModel);
if (state == ViewState.Idle) { if (state == ViewState.Idle) {
if (valadteProcedureList[0].entityList.length == 0) { if (valadteProcedureList[0].entityList.length == 0) {
await postProcedure(postProcedureReqModel, patient.patientMRN); await postProcedure(postProcedureReqModel, patient.patientMRN, isLocalBusy:isLocalBusy);
if (state == ViewState.ErrorLocal) { if (state == ViewState.ErrorLocal) {
Utils.showErrorToast(error); Utils.showErrorToast(error);
getProcedure(mrn: patient.patientMRN); getProcedure(mrn: patient.patientMRN);
} else if (state == ViewState.Idle) { } else if (state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been added'); DrAppToastMsg.showSuccesToast('procedure has been added');
if(Navigator.canPop(AppGlobal.CONTEX))
Navigator.pop(AppGlobal.CONTEX);
if(Navigator.canPop(AppGlobal.CONTEX))
Navigator.pop(AppGlobal.CONTEX);
} }
} else { } else {
if (state == ViewState.ErrorLocal) { if (state == ViewState.ErrorLocal) {
@ -464,8 +469,7 @@ class ProcedureViewModel extends BaseViewModel {
Future addProcedures(ProcedureViewModel model, Future addProcedures(ProcedureViewModel model,
List<ProcedureTempleteDetailsModel> items, List<ProcedureTempleteDetailsModel> items,
PatiantInformtion patient, PatiantInformtion patient,
TextEditingController remarksController, TextEditingController remarksController,{bool isLocalBusy = false}) async {
{bool isLocalBusy = false,}) async {
if (isLocalBusy) { if (isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
@ -489,7 +493,7 @@ class ProcedureViewModel extends BaseViewModel {
await model.preparePostProcedure( await model.preparePostProcedure(
entityList: entityList, entityList: entityList,
patient: patient, patient: patient,
remarks: remarksController.text); remarks: remarksController.text, isLocalBusy: isLocalBusy);
} }

@ -84,7 +84,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => BaseAddProcedureTabPage( builder: (context) => BaseAddProcedureTabPage(
patient: patient, patient: patient,
model: model, previousProcedureViewModel: model,
procedureType: ProcedureType.LAB_RESULT, procedureType: ProcedureType.LAB_RESULT,
), ),
settings: RouteSettings(name: 'AddProcedureTabPage'), settings: RouteSettings(name: 'AddProcedureTabPage'),

@ -88,7 +88,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
SlideUpPageRoute( SlideUpPageRoute(
widget: BaseAddProcedureTabPage( widget: BaseAddProcedureTabPage(
patient: patient, patient: patient,
model: model, previousProcedureViewModel: model,
procedureType: ProcedureType.RADIOLOGY, procedureType: ProcedureType.RADIOLOGY,
), ),
settingRoute: 'AddProcedureTabPage'), settingRoute: 'AddProcedureTabPage'),

@ -14,14 +14,14 @@ import 'package:flutter/material.dart';
class BaseAddProcedureTabPage extends StatefulWidget { class BaseAddProcedureTabPage extends StatefulWidget {
final ProcedureViewModel model; final ProcedureViewModel previousProcedureViewModel;
final PrescriptionViewModel prescriptionModel; final PrescriptionViewModel prescriptionModel;
final PatiantInformtion patient; final PatiantInformtion patient;
final ProcedureType procedureType; final ProcedureType procedureType;
const BaseAddProcedureTabPage( const BaseAddProcedureTabPage(
{Key key, {Key key,
this.model, this.previousProcedureViewModel,
this.prescriptionModel, this.prescriptionModel,
this.patient, this.patient,
@required this.procedureType}) @required this.procedureType})
@ -29,16 +29,15 @@ class BaseAddProcedureTabPage extends StatefulWidget {
@override @override
_BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState( _BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState(
patient: patient, model: model, procedureType: procedureType); patient: patient, procedureType: procedureType);
} }
class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage> class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
final ProcedureViewModel model;
final PatiantInformtion patient; final PatiantInformtion patient;
final ProcedureType procedureType; final ProcedureType procedureType;
_BaseAddProcedureTabPageState({this.patient, this.model, this.procedureType}); _BaseAddProcedureTabPageState({this.patient, this.procedureType});
TabController _tabController; TabController _tabController;
int _activeTab = 0; int _activeTab = 0;
@ -68,7 +67,11 @@ class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()); if(widget.previousProcedureViewModel == null) {
await model.getProcedureTemplate(
categoryID: widget.procedureType.getCategoryId());
}
}, },
builder: (BuildContext context, ProcedureViewModel model, Widget child) => builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold( AppScaffold(
@ -118,7 +121,7 @@ class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
controller: _tabController, controller: _tabController,
children: [ children: [
AddFavouriteProcedure( AddFavouriteProcedure(
previousProcedureViewModel: model, previousProcedureViewModel: widget.previousProcedureViewModel??model,
prescriptionModel: prescriptionModel:
widget.prescriptionModel, widget.prescriptionModel,
patient: patient, patient: patient,
@ -133,7 +136,7 @@ class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
) )
else else
AddProcedurePage( AddProcedurePage(
model: this.model, model: widget.previousProcedureViewModel,
patient: patient, patient: patient,
procedureType: procedureType, procedureType: procedureType,
), ),

@ -48,7 +48,6 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
Widget child) => Widget child) =>
AppScaffold( AppScaffold(
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model,
body: Column(children: [ body: Column(children: [
(widget.previousProcedureViewModel.templateList.length != 0) (widget.previousProcedureViewModel.templateList.length != 0)
? Expanded( ? Expanded(
@ -117,7 +116,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ProcedureCheckOutScreen( builder: (context) => ProcedureCheckOutScreen(
items: entityList, items: entityList,
model: model, previousProcedureViewModel: widget.previousProcedureViewModel,
patient: widget.patient, patient: widget.patient,
addButtonTitle: widget.procedureType addButtonTitle: widget.procedureType
.getAddButtonTitle(context), .getAddButtonTitle(context),

@ -1,9 +1,12 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -15,14 +18,14 @@ import '../../../config/config.dart';
class ProcedureCheckOutScreen extends StatefulWidget { class ProcedureCheckOutScreen extends StatefulWidget {
final List<ProcedureTempleteDetailsModel> items; final List<ProcedureTempleteDetailsModel> items;
final ProcedureViewModel model; final ProcedureViewModel previousProcedureViewModel;
final PatiantInformtion patient; final PatiantInformtion patient;
final String addButtonTitle; final String addButtonTitle;
final String toolbarTitle; final String toolbarTitle;
ProcedureCheckOutScreen( ProcedureCheckOutScreen(
{this.items, {this.items,
this.model, this.previousProcedureViewModel,
this.patient, this.patient,
@required this.addButtonTitle, @required this.addButtonTitle,
@required this.toolbarTitle}); @required this.toolbarTitle});
@ -43,48 +46,24 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
builder: (BuildContext context, ProcedureViewModel model, Widget child) => builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold( AppScaffold(
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
isShowAppBar: false, isShowAppBar: true,
appBar: PatientSearchHeader(
title: widget.toolbarTitle ?? 'Add Procedure',
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.95,
child: Column( child: Column(
children: [ children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
color: Colors.white,
),
Container(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Row(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: Icon(
Icons.arrow_back_ios_sharp,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
),
SizedBox(
width: 5.0,
),
AppText(
widget.toolbarTitle ?? 'Add Procedure',
fontWeight: FontWeight.w700,
fontSize: 20,
),
],
),
),
),
SizedBox( SizedBox(
height: 30, height: 30,
), ),
ListView.builder( ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: widget.items.length, itemCount: widget.items.length,
physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks); final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks);
@ -99,17 +78,11 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
initiallyExpanded: true, initiallyExpanded: true,
title: Row( title: Row(
children: [ children: [
Icon(
Icons.check_box,
color: Color(0xffD02127),
size: 30.5,
),
SizedBox(
width: 6.0,
),
Expanded( Expanded(
child: child:
AppText(widget.items[index].procedureName)), AppText(Utils.convertToTitleCase(widget.items[index].procedureName), fontWeight: FontWeight.w700,color: AppGlobal.appTextColor,
)),
], ],
), ),
children: [ children: [
@ -209,6 +182,8 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
], ],
), ),
), ),
),
),
bottomSheet: Container( bottomSheet: Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap( child: Wrap(
@ -221,10 +196,7 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.model.addProcedures(model, widget.items, widget.patient, remarksController, isLocalBusy: true); await widget.previousProcedureViewModel.addProcedures(widget.previousProcedureViewModel, widget.items, widget.patient, remarksController, isLocalBusy: true);
Navigator.pop(context);
Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, },
), ),

@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../widgets/shared/errors/error_message.dart'; import '../../widgets/shared/errors/error_message.dart';
@ -57,13 +58,8 @@ class ProcedureScreen extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (model.procedureList.length == 0 && if ((model.procedureList.length == 0 &&
patient.patientStatusType != 43) patient.patientStatusType != 43) || patient.patientStatusType != null &&
ServiceTitle(
title: TranslationBase.of(context).orderTestOr,
subTitle: TranslationBase.of(context).procedure,
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43)
ServiceTitle( ServiceTitle(
title: TranslationBase.of(context).orderTestOr, title: TranslationBase.of(context).orderTestOr,
@ -73,13 +69,18 @@ class ProcedureScreen extends StatelessWidget {
patient.patientStatusType == 43) || patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null)) (isFromLiveCare && patient.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getProcedureTemplate(
categoryID: ProcedureType.PROCEDURE.getCategoryId(), isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push( Navigator.push(
context, context,
SlideUpPageRoute( SlideUpPageRoute(
widget: BaseAddProcedureTabPage( widget: BaseAddProcedureTabPage(
patient: patient, patient: patient,
model: model, previousProcedureViewModel: model,
procedureType: ProcedureType.PROCEDURE, procedureType: ProcedureType.PROCEDURE,
), ),
settingRoute: 'AddProcedureTabPage'), settingRoute: 'AddProcedureTabPage'),
@ -93,6 +94,8 @@ class ProcedureScreen extends StatelessWidget {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: model.procedureList[0].rowcount, itemCount: model.procedureList[0].rowcount,
shrinkWrap: true, shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return ProcedureCard( return ProcedureCard(
categoryID: model categoryID: model

Loading…
Cancel
Save