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.
RSGDoctorApp/lib/screens/patients/profile/new-medication/intervention_medication.dart

312 lines
16 KiB
Dart

import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/vte_assessment_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_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/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/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/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class InterventionMedicationScreen extends StatefulWidget {
final PatiantInformtion patient;
const InterventionMedicationScreen(this.patient, {Key key}) : super(key: key);
@override
_InterventionMedicationScreenState createState() => _InterventionMedicationScreenState();
}
class _InterventionMedicationScreenState extends State<InterventionMedicationScreen> {
bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
return BaseView<InterventionMedicationViewModel>(
onModelReady: (model) => model.getInterventionMedication(patientId: widget.patient.patientId,
// admissionNo: 2016023498
admissionNo:int.parse(widget.patient.admissionNo)
),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileAppBar(
widget.patient,
isInpatient: true,
),
body: model.allInterventionList == null ||
model.allInterventionList.length == 0
? Center(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable,
),
)
: Container(
color: Colors.grey[200],
child: Column(
children: <Widget>[
Expanded(
child: Container(
child: ListView.builder(
itemCount: model.allInterventionList.length,
itemBuilder: (BuildContext ctxt, int index) {
return FractionallySizedBox(
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
bgColor: Colors.transparent,
widget: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.60,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
model
.allInterventionList[
index].cS,
fontWeight: FontWeight.w600,
fontSize: 14,
),
],
),
],
),
),
Column(
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate(
model
.allInterventionList[
index].startDatetime)
,isArabic:
projectViewModel
.isArabic,
isMonthShort: true),
fontWeight: FontWeight.w600,
fontSize: 14,
),
],
),
],
)
// Column(
// children: [
// AppText(
// model
// .allInterventionList[
// index]
// .startDatetime !=
// null
// ? AppDateUtils.getDayMonthYearDateFormatted(
// AppDateUtils
// .getDateTimeFromString(model
// .allInterventionList[
// index]
// .startDatetime),
// isArabic:
// projectViewModel
// .isArabic,
// isMonthShort: true)
// : AppDateUtils
// .getDayMonthYearDateFormatted(
// DateTime.now(),
// isArabic:
// projectViewModel
// .isArabic),
// fontWeight: FontWeight.w600,
// fontSize: 14,
// isCopyable: true,
// ),
// AppText(
// model
// .allInterventionList[
// index]
// .startDatetime !=
// null
// ? AppDateUtils.getHour(
// AppDateUtils
// .getDateTimeFromString(model
// .allInterventionList[
// index]
// .startDatetime))
// : AppDateUtils.getHour(
// DateTime.now()),
// fontWeight: FontWeight.w600,
// fontSize: 14,
// isCopyable: true,
// ),
// ],
// crossAxisAlignment:
// CrossAxisAlignment.end,
// )
],
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
// AppText(
// TranslationBase.of(context)
// .VTE_Type +
// " : ",
// fontSize: 12,
// ),
Expanded(
child: AppText(
model
.allInterventionList[
index]
.description,
fontSize: 12,
isCopyable: true,
),
),
]),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
// AppText(
// TranslationBase.of(context)
// .pharmacology +
// " : ",
// fontSize: 12,
// ),
Expanded(
child: AppText(
model
.allInterventionList[
index]
.medication,
fontSize: 12,
isCopyable: true,
),
),
]),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
// AppText(
// TranslationBase.of(context)
// .reasonsThrombo +
// " : ",
// fontSize: 12,
// ),
Expanded(
child: AppText(
model
.allInterventionList[
index]
.doctorComments,
fontSize: 12,
isCopyable: true,
),
),
]),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
// AppText(
// TranslationBase.of(context)
// .reasonsThrombo +
// " : ",
// fontSize: 12,
// ),
Expanded(
child: AppText(
model
.allInterventionList[
index]
.statusDescription,
fontSize: 12,
isCopyable: true,
),
),
]),
],
),
SizedBox(
height: 20,
),
],
),
),
);
}),
),
),
],
),
),
),
);
}
}