You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
9.5 KiB
Dart
224 lines
9.5 KiB
Dart
//import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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/procedures/update-procedure.dart';
|
|
import 'package:doctor_app_flutter/util/helpers.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:flutter/material.dart';
|
|
|
|
import 'ProcedureCard.dart';
|
|
import 'ProcedureType.dart';
|
|
import 'base_add_procedure_tab_page.dart';
|
|
|
|
class ProcedureScreen extends StatelessWidget {
|
|
int doctorNameP;
|
|
|
|
void initState() async {
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
|
|
doctorNameP = doctorProfile.doctorID;
|
|
}
|
|
|
|
@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'];
|
|
bool isFromLiveCare = routeArgs['isFromLiveCare'];
|
|
bool isInpatient = routeArgs['isInpatient'];
|
|
return BaseView<ProcedureViewModel>(
|
|
onModelReady: (model) => model.getProcedure(
|
|
mrn: patient.patientId,
|
|
patientType: patientType,
|
|
),
|
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
AppScaffold(
|
|
isShowAppBar: true,
|
|
backgroundColor: Colors.grey[100],
|
|
baseViewModel: model,
|
|
appBar: PatientProfileAppBar(
|
|
patient,
|
|
isInpatient: isInpatient,
|
|
),
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
if (model.procedureList.length == 0 &&
|
|
patient.patientStatusType != 43)
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(context).orderTestOr,
|
|
style: "caption2",
|
|
color: Colors.black,
|
|
fontSize: 13,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).procedure,
|
|
bold: true,
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (patient.patientStatusType != null &&
|
|
patient.patientStatusType == 43)
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(context).orderTestOr,
|
|
style: "caption2",
|
|
color: Colors.black,
|
|
fontSize: 13,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).procedure,
|
|
bold: true,
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if ((patient.patientStatusType != null &&
|
|
patient.patientStatusType == 43) ||
|
|
(isFromLiveCare && patient.appointmentNo != null))
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => BaseAddProcedureTabPage(
|
|
patient: patient,
|
|
model: model,
|
|
procedureType: ProcedureType.PROCEDURE,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
width: double.maxFinite,
|
|
height: 140,
|
|
margin: EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[300],
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Center(
|
|
child: Container(
|
|
height: 90,
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
height: 40,
|
|
width: 40,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[600],
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.add,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).addMoreProcedure,
|
|
color: Colors.grey[600],
|
|
fontWeight: FontWeight.w600,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
if (model.procedureList.isNotEmpty)
|
|
...List.generate(
|
|
model.procedureList[0].rowcount,
|
|
(index) => ProcedureCard(
|
|
categoryID:
|
|
model.procedureList[0].entityList[index].categoryID,
|
|
entityList: model.procedureList[0].entityList[index],
|
|
onTap: () {
|
|
if (model.procedureList[0].entityList[index].categoryID ==
|
|
2 ||
|
|
model.procedureList[0].entityList[index].categoryID == 4)
|
|
updateProcedureForm(context,
|
|
model: model,
|
|
patient: patient,
|
|
remarks: model
|
|
.procedureList[0].entityList[index].remarks,
|
|
orderType: model
|
|
.procedureList[0].entityList[index].orderType
|
|
.toString(),
|
|
orderNo: model
|
|
.procedureList[0].entityList[index].orderNo,
|
|
procedureName: model.procedureList[0]
|
|
.entityList[index].procedureName,
|
|
categoreId: model
|
|
.procedureList[0].entityList[index].categoryID
|
|
.toString(),
|
|
procedureId: model.procedureList[0]
|
|
.entityList[index].procedureId,
|
|
limetNo: model.procedureList[0].entityList[index]
|
|
.lineItemNo);
|
|
// } else
|
|
// Helpers.showErrorToast(
|
|
// 'You Cant Update This Procedure');
|
|
},
|
|
patient: patient,
|
|
doctorID: model?.doctorProfile?.doctorID,
|
|
),
|
|
),
|
|
if (model.state == ViewState.ErrorLocal ||
|
|
(model.procedureList.isNotEmpty &&
|
|
model.procedureList[0].entityList.isEmpty))
|
|
Center(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
height: 100,
|
|
),
|
|
Image.asset('assets/images/no-data.png'),
|
|
Padding(
|
|
padding: const EdgeInsets.all(22.0),
|
|
child: AppText(model.procedureList.isEmpty
|
|
? model.error
|
|
: 'No Procedure Found '),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|