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.
575 lines
18 KiB
Dart
575 lines
18 KiB
Dart
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
|
|
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
|
|
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
|
|
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
|
|
import 'package:doctor_app_flutter/core/model/SOAP/order-procedure.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/utils/dr_app_toast_msg.dart';
|
|
import 'package:doctor_app_flutter/utils/utils.dart';
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base.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 '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(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
|
|
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(firstPage: false);
|
|
await model.getLanguage();
|
|
await model.getPatientAssessment(patient);
|
|
widget.changeLoadingState(false);
|
|
},
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
isShowAppBar: false,
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 16, horizontal: 16),
|
|
child: Column(
|
|
children: [
|
|
treatmentStepsBar(
|
|
context, model, screenSize, patient),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
...getSelectedTreatmentStepItem(
|
|
context, model),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
));
|
|
}
|
|
|
|
Widget treatmentStepsBar(BuildContext _context, UcafViewModel model,
|
|
Size screenSize, PatiantInformtion patient) {
|
|
List<String> __treatmentSteps = [
|
|
TranslationBase.of(context).diagnosis.toUpperCase(),
|
|
TranslationBase.of(context).medications.toUpperCase(),
|
|
TranslationBase.of(context).procedures.toUpperCase(),
|
|
];
|
|
return Container(
|
|
height: screenSize.height * 0.070,
|
|
decoration: TabUtil.containerBorderDecoration(
|
|
Color(0Xffffffff), Color(0xFFCCCCCC)),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: __treatmentSteps.map((item) {
|
|
bool _isActive = __treatmentSteps[_activeTap] == item ? true : false;
|
|
return Expanded(
|
|
child: InkWell(
|
|
child: Center(
|
|
child: Container(
|
|
height: screenSize.height * 0.070,
|
|
decoration: TabUtil.containerBorderDecoration(
|
|
_isActive ? HexColor("#B8382B") : Colors.white,
|
|
_isActive ? HexColor("#B8382B") : Colors.white),
|
|
child: Center(
|
|
child: Text(
|
|
item,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: _isActive
|
|
? Colors.white
|
|
: Colors.black, //Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
)),
|
|
),
|
|
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);
|
|
});
|
|
},
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
);
|
|
}
|
|
|
|
List<Widget> getSelectedTreatmentStepItem(
|
|
BuildContext _context, UcafViewModel model) {
|
|
switch (_activeTap) {
|
|
case 0:
|
|
if (model.patientAssessmentList != null) {
|
|
return [
|
|
ListView.builder(
|
|
itemCount: model.patientAssessmentList.length,
|
|
scrollDirection: Axis.vertical,
|
|
physics: ScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
return DiagnosisWidget(
|
|
model, model.patientAssessmentList[index]);
|
|
})
|
|
];
|
|
} else {
|
|
return [
|
|
Container(),
|
|
];
|
|
}
|
|
break;
|
|
case 1:
|
|
return [
|
|
ListView.builder(
|
|
itemCount: model.prescriptionList != null
|
|
? model.prescriptionList.entityList.length
|
|
: 0,
|
|
scrollDirection: Axis.vertical,
|
|
physics: ScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
return MedicationWidget(
|
|
model, model.prescriptionList.entityList[index]);
|
|
})
|
|
];
|
|
break;
|
|
case 2:
|
|
if (model.orderProcedures != null) {
|
|
return [
|
|
ListView.builder(
|
|
itemCount: model.orderProcedures.length,
|
|
scrollDirection: Axis.vertical,
|
|
physics: ScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
return ProceduresWidget(model, model.orderProcedures[index]);
|
|
})
|
|
];
|
|
} else {
|
|
return [
|
|
Container(),
|
|
];
|
|
}
|
|
break;
|
|
default:
|
|
return [
|
|
Container(),
|
|
];
|
|
}
|
|
}
|
|
}
|
|
|
|
class DiagnosisWidget extends StatelessWidget {
|
|
final UcafViewModel model;
|
|
final GetAssessmentResModel diagnosis;
|
|
|
|
DiagnosisWidget(this.model, this.diagnosis);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
MasterKeyModel diagnosisType = model.findMasterDataById(
|
|
masterKeys: MasterKeysService.DiagnosisType,
|
|
id: diagnosis.diagnosisTypeID);
|
|
MasterKeyModel diagnosisCondition = model.findMasterDataById(
|
|
masterKeys: MasterKeysService.DiagnosisCondition,
|
|
id: diagnosis.conditionID);
|
|
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).diagnoseType}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
diagnosisType != null
|
|
? model.selectedLanguage == 'ar'
|
|
? diagnosisType.nameAr
|
|
: diagnosisType.nameEn
|
|
: "-",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AppText(
|
|
diagnosis.asciiDesc,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).condition}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).icd}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${diagnosis.icdCode10ID}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
const Divider(
|
|
color: Color(0xffCCCCCC),
|
|
height: 1,
|
|
thickness: 1,
|
|
indent: 0,
|
|
endIndent: 0,
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class MedicationWidget extends StatelessWidget {
|
|
final UcafViewModel model;
|
|
final PrescriptionEntityModel prescription;
|
|
|
|
MedicationWidget(this.model, this.prescription);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).id}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${prescription.medicineCode}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
SizedBox(
|
|
width: 16,
|
|
),
|
|
AppText(
|
|
"${TranslationBase.of(context).price}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${prescription.medicationPrice}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
SizedBox(
|
|
width: 16,
|
|
),
|
|
AppText(
|
|
"${TranslationBase.of(context).quantity}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${prescription.quantity}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).durDays}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${prescription.doseDurationDays}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AppText(
|
|
"${prescription.medicationName}",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AppText(
|
|
"${prescription.doseDetail}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
const Divider(
|
|
color: Color(0xffCCCCCC),
|
|
height: 1,
|
|
thickness: 1,
|
|
indent: 0,
|
|
endIndent: 0,
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ProceduresWidget extends StatelessWidget {
|
|
final UcafViewModel model;
|
|
final OrderProcedure procedure;
|
|
|
|
ProceduresWidget(this.model, this.procedure);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).codeNo}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
procedure.achiCode,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
Expanded(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).quantity}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${procedure.lineItemNo}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AppText(
|
|
procedure.procedureName,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).covered}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${procedure.isCovered}",
|
|
fontWeight: FontWeight.normal,
|
|
color: procedure.isCovered ? AppGlobal.appGreenColor : Colors.red,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
SizedBox(
|
|
width: 16,
|
|
),
|
|
AppText(
|
|
"${TranslationBase.of(context).approvalRequired}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${procedure.isApprovalRequired}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Row(
|
|
children: [
|
|
AppText(
|
|
"${TranslationBase.of(context).uncoveredByDoctor}: ",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
AppText(
|
|
"${procedure.isUncoveredByDoctor}",
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.0,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
const Divider(
|
|
color: Color(0xffCCCCCC),
|
|
height: 1,
|
|
thickness: 1,
|
|
indent: 0,
|
|
endIndent: 0,
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|